1
Vote

Is Unit Test DateTime_ToStringTest6 correct?

description

Using RunTests.exe on my build of MF 4.1 (Same test code in later versions), I get a Fail on DataTime_ToStringTest6().

Expected string '07/21/2582 14:12:43', but got '7/21/2582 2:12:43 PM'

Project:
C:\MicroFrameworkPK_v4_1\test\platform\tests\clr\mscorlib\systemlib\systemlib2\systemlib2.sln

The test code prepends '0' to values below 10 for all but the year field.
The MF library does not prepend the 0 and the strings do not compare.
There is also a 12 hr AM/PM clock vs. 24 hr expected by the test code.

On the Desktop MF
        DateTime dt = DateTime.Now;
        String st = dt.ToString();
Will set st = "8/3/2015 1:34:25 AM".

i,e, Desktop MF will not prepend zeros.

It would appear behaviour matches desktop, and a better unit test is required.

comments

DoingNZ wrote Aug 2, 2015 at 2:19 PM

Hmmm I am now confused.

Test passes on the actual hardware when unit test does not prepend 0 and adds AM/PM.
But it then fails on the PC emulator where it expected the 24 Hr clock and prepended zeros.

Which is the correct behaviour we want from NetMF?

I assume to match the Desktop.