On 07/18/15 05:15, YongHao Hu wrote:
- /* test the formula */
- file = CreateFileA("tr2_test_dir/f1", 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
- ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n");
- ok(GetFileTime(file, 0, 0, &lwt), "GetFileTime failed\n");
- CloseHandle(file);
- last_write_time = (((__int64)lwt.dwHighDateTime)<< 32) + lwt.dwLowDateTime;
- last_write_time -= TICKS_1601_TO_1970;
- last_write_time /= TICKSPERSEC;
- ok(last_write_time == newtime, "last_write_time after converting from FILETIME to UNIX Timestamp should equal to newtime\n");
There's no guarantee that the filesystem will store the time accurately. As far as I know the test will not work on fat file system.
- /* test negative time */
- newtime = 1111111;
- p_tr2_sys__Last_write_time_set("tr2_test_dir/f1", -newtime);
- last_write_time = p_tr2_sys__Last_write_time("tr2_test_dir/f1");
- todo_wine ok(1844674407369-newtime+1 == last_write_time, "last_write_time expect %s, got %s\n",
debugstr_longlong(1844674407369-newtime+1), debugstr_longlong(last_write_time));
You can't use debugstr_longlong 2 times inside one ok call. You can't use 64-bit constants this way. Also please avoid using "magic" constants. Is this test still failing on wine if unsigned __int64 is used in computations?
- /* maximum time */
- newtime = 9223372036854775807;
- p_tr2_sys__Last_write_time_set("tr2_test_dir/f1", newtime);
- todo_wine ok(1844674407369 == p_tr2_sys__Last_write_time("tr2_test_dir/f1"), "last_write_time expect 1844674407369, got %s\n",
debugstr_longlong(p_tr2_sys__Last_write_time("tr2_test_dir/f1")));
I'm expecting it to fail on some filesystems. It would be nice to run this tests on fat32 filesystem.
Cheers, Piotr