Changeset 14658
- Timestamp:
- Jan 4, 2016, 5:04:55 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/file-test.c
r14586 r14658 94 94 clear_path_info (tr_sys_path_info * info) 95 95 { 96 info->type = (tr_sys_path_type_t) -1;97 info->size = (uint64_t) -1;98 info->last_modified_at = (time_t) -1;96 info->type = (tr_sys_path_type_t) -1; 97 info->size = (uint64_t) -1; 98 info->last_modified_at = (time_t) -1; 99 99 } 100 100 … … 166 166 tr_error * err = NULL; 167 167 char * path1, * path2; 168 time_t t; 168 169 169 170 path1 = tr_buildPath (test_dir, "a", NULL); … … 175 176 tr_error_clear (&err); 176 177 178 t = time (NULL); 177 179 libtest_create_file_with_string_contents (path1, "test"); 178 180 … … 183 185 check_int_eq (TR_SYS_PATH_IS_FILE, info.type); 184 186 check_int_eq (4, info.size); 185 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));187 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 186 188 187 189 /* Good file info (by handle) */ … … 192 194 check_int_eq (TR_SYS_PATH_IS_FILE, info.type); 193 195 check_int_eq (4, info.size); 194 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));196 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 195 197 tr_sys_file_close (fd, NULL); 196 198 … … 198 200 199 201 /* Good directory info */ 202 t = time (NULL); 200 203 tr_sys_dir_create (path1, 0, 0777, NULL); 201 204 clear_path_info (&info); … … 203 206 check (err == NULL); 204 207 check_int_eq (TR_SYS_PATH_IS_DIRECTORY, info.type); 205 check (info.size != (uint64_t) -1);206 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));208 check (info.size != (uint64_t) -1); 209 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 207 210 tr_sys_path_remove (path1, NULL); 208 211 … … 214 217 tr_error_clear (&err); 215 218 219 t = time (NULL); 216 220 libtest_create_file_with_string_contents (path2, "test"); 217 221 … … 222 226 check_int_eq (TR_SYS_PATH_IS_FILE, info.type); 223 227 check_int_eq (4, info.size); 224 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));228 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 225 229 226 230 /* Good file info (by handle) */ … … 231 235 check_int_eq (TR_SYS_PATH_IS_FILE, info.type); 232 236 check_int_eq (4, info.size); 233 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));237 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 234 238 tr_sys_file_close (fd, NULL); 235 239 … … 237 241 238 242 /* Good directory info */ 243 t = time (NULL); 239 244 tr_sys_dir_create (path2, 0, 0777, NULL); 240 245 clear_path_info (&info); … … 242 247 check (err == NULL); 243 248 check_int_eq (TR_SYS_PATH_IS_DIRECTORY, info.type); 244 check (info.size != (uint64_t) -1);245 check (info.last_modified_at >= t ime(0) - 1 && info.last_modified_at <= time(0));249 check (info.size != (uint64_t) -1); 250 check (info.last_modified_at >= t && info.last_modified_at <= time (NULL)); 246 251 247 252 tr_sys_path_remove (path2, NULL);
Note: See TracChangeset
for help on using the changeset viewer.