Example #1
0
/*----------------------------------------------------------------------
|   TestSuiteSetDateTimeZone
+---------------------------------------------------------------------*/
static void
TestSuiteSetDateTimeZone()
{
    NPT_TimeStamp now, now2;
    NPT_Date      today, today2;
    NPT_TimeZone  tz;

    /* get utc time */
    SHOULD_SUCCEED(NPT_System::GetCurrentTimeStamp(now));

    /* convert utc time to date */
    SHOULD_SUCCEED(NPT_Time::GetGMTDateFromTimeStamp(now, today));

    for (tz = -60*12; tz <= 60*12; tz+=30) {
        /* convert date to another timezone */
        today2 = today;
        SHOULD_SUCCEED(PLT_Time::SetDateTimeZone(today2, tz));

        /* get timestamp from converted date */
        SHOULD_SUCCEED(PLT_Time::GetTimeStampFromDate(today2, now2));

        /* verify utc time has not change */
        SHOULD_EQUAL_I(now.m_Seconds, now2.m_Seconds);
    }
}
Example #2
0
/*----------------------------------------------------------------------
|   TestSuiteGetTime
+---------------------------------------------------------------------*/
static void
TestSuiteGetTime()
{
    NPT_TimeStamp now, now2;
    NPT_Date      today;

    /* get utc time */
    SHOULD_SUCCEED(NPT_System::GetCurrentTimeStamp(now));

    /* convert utc time to date */
    SHOULD_SUCCEED(NPT_Time::GetGMTDateFromTimeStamp(now, today));

    /* convert local time back to utc */
    SHOULD_SUCCEED(PLT_Time::GetTimeStampFromDate(today, now2));

    /* verify utc time has not change */
    SHOULD_EQUAL_I(now.m_Seconds, now2.m_Seconds);
}
Example #3
0
/*----------------------------------------------------------------------
|       main
+---------------------------------------------------------------------*/
int 
main(int argc, char** argv)
{
    float f;
    long  i;

    ATX_COMPILER_UNUSED(argc);
    ATX_COMPILER_UNUSED(argv);

    SHOULD_FAIL(ATX_ParseInteger("ssdfsdf", &i, ATX_FALSE), "test a1");
    SHOULD_FAIL(ATX_ParseInteger("", &i, ATX_FALSE), "test a2");
    SHOULD_FAIL(ATX_ParseInteger(NULL, &i, ATX_FALSE), "test a3");
    SHOULD_FAIL(ATX_ParseInteger("123a", &i, ATX_FALSE), "test a4");
    SHOULD_FAIL(ATX_ParseInteger("a123", &i, ATX_FALSE), "test a5");
    SHOULD_FAIL(ATX_ParseInteger(" 123", &i, ATX_FALSE), "test a6");
    SHOULD_FAIL(ATX_ParseInteger("a 123", &i, ATX_TRUE), "test a7");
    SHOULD_FAIL(ATX_ParseInteger(" a123", &i, ATX_TRUE), "test a8");

    SHOULD_SUCCEED(ATX_ParseInteger("+1", &i, ATX_FALSE), "test b1");
    SHOULD_EQUAL_I(i, 1, "test b1");
    SHOULD_SUCCEED(ATX_ParseInteger("+123", &i, ATX_FALSE), "test b2");
    SHOULD_EQUAL_I(i, 123, "test b2");
    SHOULD_SUCCEED(ATX_ParseInteger("-1", &i, ATX_FALSE), "test b3");
    SHOULD_EQUAL_I(i, -1, "test b3");
    SHOULD_SUCCEED(ATX_ParseInteger("-123", &i, ATX_FALSE), "test b4");
    SHOULD_EQUAL_I(i, -123, "test b4");
    SHOULD_SUCCEED(ATX_ParseInteger("-123fgs", &i, ATX_TRUE), "test b5");
    SHOULD_EQUAL_I(i, -123, "test b5");
    SHOULD_SUCCEED(ATX_ParseInteger("  -123fgs", &i, ATX_TRUE), "test b6");
    SHOULD_EQUAL_I(i, -123, "b6");
    SHOULD_SUCCEED(ATX_ParseInteger("0", &i, ATX_TRUE), "test b7");
    SHOULD_EQUAL_I(i, 0, "b7");
    SHOULD_SUCCEED(ATX_ParseInteger("7768", &i, ATX_TRUE), "test b8");
    SHOULD_EQUAL_I(i, 7768, "b8");

    SHOULD_FAIL(ATX_ParseFloat("ssdfsdf", &f, ATX_FALSE), "test c1");
    SHOULD_FAIL(ATX_ParseFloat("", &f, ATX_FALSE), "test c2");
    SHOULD_FAIL(ATX_ParseFloat(NULL, &f, ATX_FALSE), "test c3");
    SHOULD_FAIL(ATX_ParseFloat("123.", &f, ATX_FALSE), "test c4");
    SHOULD_FAIL(ATX_ParseFloat("a123", &f, ATX_FALSE), "test c5");
    SHOULD_FAIL(ATX_ParseFloat(" 123", &f, ATX_FALSE), "test c6");
    SHOULD_FAIL(ATX_ParseFloat(" 127.89E5ff", &f, ATX_FALSE), "test c7");

    SHOULD_SUCCEED(ATX_ParseFloat("+1.0", &f, ATX_FALSE), "test d1");
    SHOULD_EQUAL_F(f, 1.0f, "test d1");
    SHOULD_SUCCEED(ATX_ParseFloat("+123", &f, ATX_FALSE), "test d2");
    SHOULD_EQUAL_F(f, 123.0f, "test d2");
    SHOULD_SUCCEED(ATX_ParseFloat("-0.1", &f, ATX_FALSE), "test d3");
    SHOULD_EQUAL_F(f, -0.1f, "test d3");
    SHOULD_SUCCEED(ATX_ParseFloat("0.23e-13", &f, ATX_FALSE), "test d4");
    SHOULD_EQUAL_F(f, 0.23e-13f, "test d4");
    SHOULD_SUCCEED(ATX_ParseFloat(" 127.89E5ff", &f, ATX_TRUE), "test d5");
    SHOULD_EQUAL_F(f, 127.89E5f, "test d5");
    SHOULD_SUCCEED(ATX_ParseFloat("+0.3db", &f, ATX_TRUE), "test d6");
    SHOULD_EQUAL_F(f, 0.3f, "d6");
    SHOULD_SUCCEED(ATX_ParseFloat("+.3db", &f, ATX_TRUE), "test d7");
    SHOULD_EQUAL_F(f, 0.3f, "d7");
    SHOULD_SUCCEED(ATX_ParseFloat("-.3db", &f, ATX_TRUE), "test d8");
    SHOULD_EQUAL_F(f, -0.3f, "d8");
    SHOULD_SUCCEED(ATX_ParseFloat(".3db", &f, ATX_TRUE), "test d9");
    SHOULD_EQUAL_F(f, .3f, "d9");

    return 0;
}
Example #4
0
/*----------------------------------------------------------------------
|       main
+---------------------------------------------------------------------*/
int
main(int /*argc*/, char** /*argv*/)
{
    NPT_Result result;


    NPT_String t = "hello";
    NPT_String base64;
    NPT_DataBuffer data;
    result = NPT_Base64::Encode((const NPT_Byte*)t.GetChars(), t.GetLength(), base64);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(base64 == "aGVsbG8=");
    result = NPT_Base64::Decode(base64.GetChars(), base64.GetLength(), data);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(data.GetDataSize() == t.GetLength());
    NPT_String tt((const char*)data.GetData(), data.GetDataSize());
    NPT_ASSERT(tt == t);

    t = "hello!";
    result = NPT_Base64::Encode((const NPT_Byte*)t.GetChars(), t.GetLength(), base64);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(base64 == "aGVsbG8h");
    result = NPT_Base64::Decode(base64.GetChars(), base64.GetLength(), data);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(data.GetDataSize() == t.GetLength());
    tt.Assign((const char*)data.GetData(), data.GetDataSize());
    NPT_ASSERT(tt == t);

    t = "hello!!";
    result = NPT_Base64::Encode((const NPT_Byte*)t.GetChars(), t.GetLength(), base64);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(base64 == "aGVsbG8hIQ==");
    result = NPT_Base64::Decode(base64.GetChars(), base64.GetLength(), data);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(data.GetDataSize() == t.GetLength());
    tt.Assign((const char*)data.GetData(), data.GetDataSize());
    NPT_ASSERT(tt == t);
    
    unsigned char r256_bin[] = {
        0x7d, 0x5f, 0xd0, 0xf4, 0x6a, 0xa8, 0xae, 0x34, 0x6e, 0x32, 0x1d, 0xa1,
        0xef, 0x66, 0xdd, 0x82, 0x76, 0xa6, 0xfd, 0x8c, 0x75, 0x97, 0xa0, 0x01,
        0x00, 0xde, 0x52, 0xef, 0xdf, 0xb6, 0x3e, 0xe4, 0x7b, 0x45, 0xdd, 0x2b,
        0xa1, 0x9c, 0xb0, 0x6d, 0x2c, 0x75, 0xb1, 0x87, 0x43, 0x0f, 0xea, 0x24,
        0x36, 0x11, 0x7e, 0xee, 0xd1, 0x91, 0x7f, 0x7b, 0x02, 0xea, 0x9a, 0x2a,
        0x25, 0xc0, 0xac, 0x99, 0xa4, 0x89, 0x55, 0x5b, 0x82, 0xdf, 0xb0, 0x7e,
        0xa1, 0x78, 0x0f, 0xdf, 0x25, 0x5f, 0x3d, 0xba, 0xcb, 0xbc, 0x35, 0x04,
        0xc3, 0xf4, 0xb8, 0xc0, 0x17, 0x8e, 0x75, 0x01, 0xe6, 0x2f, 0x88, 0x2c,
        0x76, 0x0a, 0x8c, 0x3f, 0x83, 0xd4, 0x10, 0xa8, 0x00, 0xfc, 0xa0, 0x92,
        0x7b, 0xae, 0xa3, 0x8c, 0x47, 0xea, 0x25, 0xf9, 0x29, 0x81, 0x1c, 0x21,
        0xf2, 0xf4, 0xfe, 0x07, 0x7e, 0x4b, 0x01, 0x79, 0x41, 0x3a, 0xb6, 0x71,
        0x0b, 0x75, 0xa7, 0x9d, 0x1b, 0x12, 0xc4, 0x46, 0x06, 0xf3, 0x5f, 0x00,
        0x05, 0x2a, 0x1b, 0x34, 0xd6, 0x87, 0xc4, 0x70, 0xcc, 0xc3, 0x9e, 0xa8,
        0x24, 0x2c, 0x97, 0x4e, 0xfc, 0x91, 0x70, 0x1c, 0x29, 0x66, 0xc3, 0x23,
        0xbf, 0xd7, 0x4d, 0x35, 0x51, 0xff, 0xeb, 0xde, 0x45, 0xbd, 0x8d, 0x80,
        0x44, 0x2a, 0x8d, 0xc0, 0xe8, 0x6a, 0xe2, 0x86, 0x46, 0x9f, 0xf2, 0x3c,
        0x93, 0x0d, 0x27, 0x02, 0xe4, 0x79, 0xa1, 0x21, 0xf4, 0x43, 0xcd, 0x4c,
        0x22, 0x25, 0x9e, 0x93, 0xeb, 0x77, 0x8e, 0x1e, 0x57, 0x1e, 0x9b, 0xcb,
        0x91, 0x86, 0xcf, 0x15, 0xaf, 0xd5, 0x03, 0x0f, 0x70, 0xbe, 0x6e, 0x37,
        0xea, 0x37, 0xdd, 0xf6, 0xa1, 0xb1, 0xf7, 0x05, 0xbc, 0x2d, 0x44, 0x60,
        0x35, 0xa4, 0x05, 0x0b, 0x22, 0x7d, 0x7a, 0x71, 0xe5, 0x1d, 0x8e, 0xcb,
        0xc3, 0xb8, 0x3a, 0xe1
    };
    NPT_String b64;
    NPT_Base64::Encode(r256_bin, sizeof(r256_bin), b64);
    NPT_DataBuffer r256_out;
    NPT_Base64::Decode(b64.GetChars(), b64.GetLength(), r256_out);
    NPT_ASSERT(r256_out.GetDataSize() == sizeof(r256_bin));
    NPT_ASSERT(r256_bin[sizeof(r256_bin)-1] == r256_out.GetData()[sizeof(r256_bin)-1]);

    unsigned char random_bytes[] = {
        0xc7, 0xee, 0x49, 0x9e, 0x2c, 0x8b, 0x1c, 0x16, 0x9e, 0x7f, 0x30, 0xd0,
        0xc6, 0x12, 0x30, 0x80, 0x81, 0xcd, 0x20, 0x20, 0x26, 0xaf, 0x4f, 0xd6,
        0xfc, 0x86, 0x2e, 0x85, 0xf3, 0x10, 0x38, 0x2b, 0x0e, 0xbb, 0x80, 0x68,
        0xbe, 0xff, 0x1c, 0xdc, 0x72, 0xb5, 0x0d, 0x8f, 0x8e, 0x6c, 0x09, 0x63,
        0xba, 0x21, 0x23, 0xb2, 0x24, 0x17, 0xd3, 0x17, 0x69, 0x44, 0x77, 0x11,
        0x36, 0x6a, 0x6e, 0xf2, 0x44, 0x87, 0xa1, 0xd3, 0xf3, 0x1f, 0x6c, 0x38,
        0x22, 0x4a, 0x44, 0x70, 0x66, 0xef, 0x8c, 0x3a, 0x51, 0xc8, 0xee, 0x85,
        0x00, 0x25, 0x93, 0x10, 0x2e, 0x0b, 0x1b, 0x03, 0x94, 0x47, 0x05, 0x22,
        0xd0, 0xc4, 0xec, 0x2e, 0xcc, 0xbc, 0xbb, 0x67, 0xfd, 0xec, 0x0e, 0xb1,
        0x3f, 0xbc, 0x82, 0xe0, 0xa7, 0x9c, 0xf3, 0xae, 0xbd, 0xb7, 0xab, 0x02,
        0xf1, 0xd9, 0x17, 0x4c, 0x9d, 0xeb, 0xe2, 0x00, 0x1e, 0x19, 0x6e, 0xb3,
        0xfd, 0x7d, 0xea, 0x49, 0x85, 0x43, 0x2f, 0x56, 0x81, 0x89, 0xba, 0x71,
        0x37, 0x10, 0xb5, 0x74, 0xab, 0x90, 0x4d, 0xc4, 0xd1, 0x0d, 0x8d, 0x6f,
        0x01, 0xf5, 0x2c, 0xc9, 0x1a, 0x79, 0xa1, 0x41, 0x71, 0x2b, 0xfb, 0xf3,
        0xd5, 0xe4, 0x2a, 0xf5, 0xad, 0x80, 0x7a, 0x03, 0xff, 0x5f, 0x45, 0x8c,
        0xec, 0x6a, 0x4b, 0x05, 0xe3, 0x65, 0x19, 0x70, 0x05, 0xad, 0xc4, 0xb8,
        0x4e, 0x9e, 0x9a, 0x36, 0x4a, 0x86, 0x9d, 0xf5, 0x99, 0xcb, 0x00, 0xb8,
        0xb9, 0xa7, 0x86, 0x18, 0xfc, 0x9a, 0xe7, 0x00, 0x6a, 0x67, 0xfa, 0x42,
        0x9d, 0xff, 0x4d, 0x7a, 0xe4, 0xe8, 0x03, 0x88, 0xff, 0x60, 0xe1, 0x8d,
        0x09, 0x5f, 0x6f, 0xde, 0x6b
    };
    NPT_Array<unsigned char> random(random_bytes, NPT_ARRAY_SIZE(random_bytes));

    t = "x+5JniyLHBaefzDQxhIwgIHNICAmr0/W/IYuhfMQOCsOu4Bovv8c3HK1DY+ObAlj\r\n"
        "uiEjsiQX0xdpRHcRNmpu8kSHodPzH2w4IkpEcGbvjDpRyO6FACWTEC4LGwOURwUi\r\n"
        "0MTsLsy8u2f97A6xP7yC4Kec8669t6sC8dkXTJ3r4gAeGW6z/X3qSYVDL1aBibpx\r\n"
        "NxC1dKuQTcTRDY1vAfUsyRp5oUFxK/vz1eQq9a2AegP/X0WM7GpLBeNlGXAFrcS4\r\n"
        "Tp6aNkqGnfWZywC4uaeGGPya5wBqZ/pCnf9NeuToA4j/YOGNCV9v3ms=";
    result = NPT_Base64::Decode(t.GetChars(), t.GetLength(), data);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(data.GetDataSize() == 233);
    NPT_Array<unsigned char> verif(data.GetData(), data.GetDataSize());
    NPT_ASSERT(verif == random);

    result = NPT_Base64::Encode(&random[0], random.GetItemCount(), base64, NPT_BASE64_PEM_BLOCKS_PER_LINE);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(base64 == t);

    NPT_String t_url = t;
    t.Replace('/', '_');
    t.Replace('+', '-');
    result = NPT_Base64::Encode(&random[0], random.GetItemCount(), base64, NPT_BASE64_PEM_BLOCKS_PER_LINE, true);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(base64 == t);
    
    t = "76768484767685839";
    result = NPT_Base64::Decode(t.GetChars(), t.GetLength(), data);
    NPT_ASSERT(result == NPT_ERROR_INVALID_FORMAT);

    t = "76869=978686";
    result = NPT_Base64::Decode(t.GetChars(), t.GetLength(), data);
    NPT_ASSERT(result == NPT_ERROR_INVALID_FORMAT);

    t = "7686=8978686";
    result = NPT_Base64::Decode(t.GetChars(), t.GetLength(), data);
    NPT_ASSERT(result == NPT_ERROR_INVALID_FORMAT);

    t = "7686==978686";
    result = NPT_Base64::Decode(t.GetChars(), t.GetLength(), data);
    NPT_ASSERT(result == NPT_ERROR_INVALID_FORMAT);

    // test IP address parsing
    NPT_IpAddress ip;
    NPT_ASSERT(NPT_FAILED(ip.Parse("")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("a.b.c.d")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.2.3.4.5")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.2.3.4.")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.2.3.4f")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.g.3.4")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.2..3.4")));
    NPT_ASSERT(NPT_FAILED(ip.Parse("1.2.300.4")));
    NPT_ASSERT(NPT_SUCCEEDED(ip.Parse("1.2.3.4")));
    NPT_ASSERT(ip.AsBytes()[0] == 1);
    NPT_ASSERT(ip.AsBytes()[1] == 2);
    NPT_ASSERT(ip.AsBytes()[2] == 3);
    NPT_ASSERT(ip.AsBytes()[3] == 4);
    NPT_ASSERT(NPT_SUCCEEDED(ip.Parse("255.255.0.1")));
    NPT_ASSERT(ip.AsBytes()[0] == 255);
    NPT_ASSERT(ip.AsBytes()[1] == 255);
    NPT_ASSERT(ip.AsBytes()[2] == 0);
    NPT_ASSERT(ip.AsBytes()[3] == 1);
    NPT_ASSERT(NPT_SUCCEEDED(ip.Parse("0.0.0.0")));
    NPT_ASSERT(ip.AsBytes()[0] == 0);
    NPT_ASSERT(ip.AsBytes()[1] == 0);
    NPT_ASSERT(ip.AsBytes()[2] == 0);
    NPT_ASSERT(ip.AsBytes()[3] == 0);

    // MIME parameter parser
    NPT_Map<NPT_String,NPT_String> params;
    result = NPT_ParseMimeParameters(NULL, params);
    NPT_ASSERT(result == NPT_ERROR_INVALID_PARAMETERS);
    
    result = NPT_ParseMimeParameters("", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 0);
        
    result = NPT_ParseMimeParameters("foo=bar", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar");
    params.Clear();

    result = NPT_ParseMimeParameters(" foo =bar", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar");
    params.Clear();

    result = NPT_ParseMimeParameters(" foo= bar", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar");
    params.Clear();
    
    result = NPT_ParseMimeParameters(" foo= bar;", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar");
    params.Clear();

    result = NPT_ParseMimeParameters("foo=\"bar\"", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar");
    params.Clear();

    result = NPT_ParseMimeParameters("foo=\"ba\"r\"", params);
    NPT_ASSERT(result == NPT_ERROR_INVALID_SYNTAX);
    params.Clear();

    result = NPT_ParseMimeParameters("foo=\"ba\\\"r\"", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "ba\"r");
    params.Clear();

    result = NPT_ParseMimeParameters("foo=\"bar\\\"\"", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar\"");
    params.Clear();

    result = NPT_ParseMimeParameters("foo=\"bar\\\\\"", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 1);
    NPT_ASSERT(params["foo"] == "bar\\");
    params.Clear();

    result = NPT_ParseMimeParameters("a=1;b=2; c=3; d=4 ; e=\"\\;\"; f=\";\"", params);
    NPT_ASSERT(NPT_SUCCEEDED(result));
    NPT_ASSERT(params.GetEntryCount() == 6);
    NPT_ASSERT(params["a"] == "1");
    NPT_ASSERT(params["b"] == "2");
    NPT_ASSERT(params["c"] == "3");
    NPT_ASSERT(params["d"] == "4");
    NPT_ASSERT(params["e"] == ";");
    NPT_ASSERT(params["f"] == ";");
    params.Clear();

    // number parsing
    float      f;
    int        i;
    NPT_Int32  i32;
    NPT_UInt32 ui32;
    NPT_Int64  i64;
    NPT_UInt64 ui64;

    SHOULD_FAIL(NPT_ParseInteger("ssdfsdf", i, false));
    SHOULD_FAIL(NPT_ParseInteger("", i, false));
    SHOULD_FAIL(NPT_ParseInteger(NULL, i, false));
    SHOULD_FAIL(NPT_ParseInteger("123a", i, false));
    SHOULD_FAIL(NPT_ParseInteger("a123", i, false));
    SHOULD_FAIL(NPT_ParseInteger(" 123", i, false));
    SHOULD_FAIL(NPT_ParseInteger("a 123", i, true));
    SHOULD_FAIL(NPT_ParseInteger(" a123", i, true));

    SHOULD_SUCCEED(NPT_ParseInteger("+1", i, false));
    SHOULD_EQUAL_I(i, 1);
    SHOULD_SUCCEED(NPT_ParseInteger("+123", i, false));
    SHOULD_EQUAL_I(i, 123);
    SHOULD_SUCCEED(NPT_ParseInteger("-1", i, false));
    SHOULD_EQUAL_I(i, -1);
    SHOULD_SUCCEED(NPT_ParseInteger("-123", i, false));
    SHOULD_EQUAL_I(i, -123);
    SHOULD_SUCCEED(NPT_ParseInteger("-123fgs", i, true));
    SHOULD_EQUAL_I(i, -123);
    SHOULD_SUCCEED(NPT_ParseInteger("  -123fgs", i, true));
    SHOULD_EQUAL_I(i, -123);
    SHOULD_SUCCEED(NPT_ParseInteger("0", i, true));
    SHOULD_EQUAL_I(i, 0);
    SHOULD_SUCCEED(NPT_ParseInteger("7768", i, true));
    SHOULD_EQUAL_I(i, 7768);

    SHOULD_SUCCEED(NPT_ParseInteger32("2147483647", i32, false));
    SHOULD_EQUAL_I(i32, 2147483647);
    SHOULD_SUCCEED(NPT_ParseInteger32("-2147483647", i32, false));
    SHOULD_EQUAL_I(i32, -2147483647);
    SHOULD_SUCCEED(NPT_ParseInteger32("-2147483648", i32, false));
    SHOULD_EQUAL_I(i32, (-2147483647 - 1));
    SHOULD_FAIL(NPT_ParseInteger32("2147483648", i32, false));
    SHOULD_FAIL(NPT_ParseInteger32("-2147483649", i32, false));
    SHOULD_FAIL(NPT_ParseInteger32("-21474836480", i32, false));
    SHOULD_FAIL(NPT_ParseInteger32("21474836470", i32, false));

    SHOULD_SUCCEED(NPT_ParseInteger32U("4294967295", ui32, false));
    SHOULD_EQUAL_I(ui32, 4294967295U);
    SHOULD_FAIL(NPT_ParseInteger32U("4294967296", ui32, false));
    SHOULD_FAIL(NPT_ParseInteger32U("-1", ui32, false));

    SHOULD_SUCCEED(NPT_ParseInteger64("9223372036854775807", i64, false));
    SHOULD_EQUAL_I(i64, NPT_INT64_C(9223372036854775807));
    SHOULD_SUCCEED(NPT_ParseInteger64("-9223372036854775807", i64, false));
    SHOULD_EQUAL_I(i64, NPT_INT64_C(-9223372036854775807));
    SHOULD_SUCCEED(NPT_ParseInteger64("-9223372036854775808", i64, false));
    SHOULD_EQUAL_I(i64, (NPT_INT64_C(-9223372036854775807) - NPT_INT64_C(1)));
    SHOULD_FAIL(NPT_ParseInteger64("9223372036854775808", i64, false));
    SHOULD_FAIL(NPT_ParseInteger64("-9223372036854775809", i64, false));
    SHOULD_FAIL(NPT_ParseInteger64("-9223372036854775897", i64, false));
    SHOULD_FAIL(NPT_ParseInteger64("9223372036854775897", i64, false));

    SHOULD_SUCCEED(NPT_ParseInteger64U("18446744073709551615", ui64, false));
    SHOULD_EQUAL_I(ui64, NPT_UINT64_C(18446744073709551615));
    SHOULD_FAIL(NPT_ParseInteger64U("18446744073709551616", ui64, false));
    SHOULD_FAIL(NPT_ParseInteger64U("-1", ui64, false));

    SHOULD_FAIL(NPT_ParseFloat("ssdfsdf", f, false));
    SHOULD_FAIL(NPT_ParseFloat("", f, false));
    SHOULD_FAIL(NPT_ParseFloat(NULL, f, false));
    SHOULD_FAIL(NPT_ParseFloat("123.", f, false));
    SHOULD_FAIL(NPT_ParseFloat("a123", f, false));
    SHOULD_FAIL(NPT_ParseFloat(" 123", f, false));
    SHOULD_FAIL(NPT_ParseFloat(" 127.89E5ff", f, false));

    SHOULD_SUCCEED(NPT_ParseFloat("+1.0", f, false));
    SHOULD_EQUAL_F(f, 1.0f);
    SHOULD_SUCCEED(NPT_ParseFloat("+123", f, false));
    SHOULD_EQUAL_F(f, 123.0f);
    SHOULD_SUCCEED(NPT_ParseFloat("-0.1", f, false));
    SHOULD_EQUAL_F(f, -0.1f);
    SHOULD_SUCCEED(NPT_ParseFloat("0.23e-13", f, false));
    SHOULD_EQUAL_F(f, 0.23e-13f);
    SHOULD_SUCCEED(NPT_ParseFloat(" 127.89E5ff", f, true));
    SHOULD_EQUAL_F(f, 127.89E5f);
    SHOULD_SUCCEED(NPT_ParseFloat("+0.3db", f, true));
    SHOULD_EQUAL_F(f, 0.3f);
    SHOULD_SUCCEED(NPT_ParseFloat("+.3db", f, true));
    SHOULD_EQUAL_F(f, 0.3f);
    SHOULD_SUCCEED(NPT_ParseFloat("-.3db", f, true));
    SHOULD_EQUAL_F(f, -0.3f);
    SHOULD_SUCCEED(NPT_ParseFloat(".3db", f, true));
    SHOULD_EQUAL_F(f, .3f);

    return 0;
}
/*----------------------------------------------------------------------
|   TestMisc
+---------------------------------------------------------------------*/
static void
TestMisc()
{
    NPT_DateTime  date;
    NPT_TimeStamp ts;
    NPT_String    s;
    
    NPT_System::GetCurrentTimeStamp(ts);
    SHOULD_SUCCEED(date.FromTimeStamp(ts, false));
    s = date.ToString(NPT_DateTime::FORMAT_W3C);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_ANSI);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1036);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1123);
    NPT_Console::OutputF("%s\n", s.GetChars());
    SHOULD_SUCCEED(date.FromTimeStamp(ts, true));
    s = date.ToString(NPT_DateTime::FORMAT_W3C);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_ANSI);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1036);
    NPT_Console::OutputF("%s\n", s.GetChars());
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1123);
    NPT_Console::OutputF("%s\n", s.GetChars());

    ts = 0.0;
    SHOULD_SUCCEED(date.FromTimeStamp(ts, false));
    s = date.ToString(NPT_DateTime::FORMAT_W3C);
    SHOULD_EQUAL_S(s.GetChars(), "1970-01-01T00:00:00Z");
    s = date.ToString(NPT_DateTime::FORMAT_ANSI);
    SHOULD_EQUAL_S(s.GetChars(), "Thu Jan  1 00:00:00 1970");
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1036);
    SHOULD_EQUAL_S(s.GetChars(), "Thursday, 01-Jan-70 00:00:00 GMT");
    s = date.ToString(NPT_DateTime::FORMAT_RFC_1123);
    SHOULD_EQUAL_S(s.GetChars(), "Thu, 01 Jan 1970 00:00:00 GMT");
    
    ts.SetSeconds(0xFFFFFFFF);
    SHOULD_SUCCEED(date.FromTimeStamp(ts, false));
    s = date.ToString(NPT_DateTime::FORMAT_W3C, false);
    SHOULD_EQUAL_S(s.GetChars(), "2106-02-07T06:28:15Z");

    NPT_TimeStamp now;
    NPT_System::GetCurrentTimeStamp(now);
    NPT_DateTime now_local(now, true);
    NPT_DateTime now_utc(now, false);
    SHOULD_EQUAL_I(now_utc.m_TimeZone, 0);
    NPT_TimeStamp ts1, ts2;
    now_local.ToTimeStamp(ts1);
    now_utc.ToTimeStamp(ts2);
    SHOULD_EQUAL_I((int)ts1.ToSeconds(), (int)ts2.ToSeconds());
    
    ts.SetSeconds(0);
    NPT_DateTime d1(ts);
    ts.SetSeconds(ts.ToSeconds()-3600);
    NPT_DateTime d2(ts);
    d1.ToTimeStamp(ts1);
    d2.ToTimeStamp(ts2);
    SHOULD_EQUAL_I((int)ts1.ToSeconds(), (int)ts2.ToSeconds()+3600);
}
/*----------------------------------------------------------------------
|   TestDateFromTimeStringRFC_1123
+---------------------------------------------------------------------*/
static void
TestDateFromTimeStringRFC_1123()
{
    NPT_DateTime date;

    /* Valid date */
    SHOULD_SUCCEED(date.FromString("Fri, 14 Apr 2006 12:01:10 UT", NPT_DateTime::FORMAT_RFC_1123));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date with timezone*/
    SHOULD_SUCCEED(date.FromString("Fri, 14 Apr 2006 12:01:10 GMT", NPT_DateTime::FORMAT_RFC_1123));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date with timezone*/
    SHOULD_SUCCEED(date.FromString("Fri, 14 Apr 2006 12:01:10 +0800", NPT_DateTime::FORMAT_RFC_1123));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 8*60);

    /* Valid date, short year */
    SHOULD_SUCCEED(date.FromString("Fri, 14 Apr 95 12:01:10 GMT", NPT_DateTime::FORMAT_RFC_1123));
    SHOULD_EQUAL_I(date.m_Year         , 1995);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Wrong day name */
    SHOULD_FAIL(date.FromString("Friday, 14 Apr 95 12:01:10 GMT", NPT_DateTime::FORMAT_RFC_1123));

    /* Wrong weekday */
    SHOULD_FAIL(date.FromString("Wed, 14 Apr 2006 12:01:10 GMT", NPT_DateTime::FORMAT_RFC_1123));

    /* Wrong year length */
    SHOULD_FAIL(date.FromString("Mon, 14 Apr 95 12:01:10 GMT", NPT_DateTime::FORMAT_RFC_1123));
}
/*----------------------------------------------------------------------
|   TestDateFromTimeStringANSI
+---------------------------------------------------------------------*/
static void
TestDateFromTimeStringANSI()
{
    NPT_DateTime date;

    /* Valid date */
    SHOULD_SUCCEED(date.FromString("Fri Apr 14 12:01:10 2006", NPT_DateTime::FORMAT_ANSI));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date with space in the days */
    SHOULD_SUCCEED(date.FromString("Fri Apr  7 12:01:10 2006", NPT_DateTime::FORMAT_ANSI));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 7);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Wrong weekday */
    SHOULD_FAIL(date.FromString("Wed Apr 14 12:01:10 2006", NPT_DateTime::FORMAT_ANSI));

    /* Wrong year length */
    SHOULD_FAIL(date.FromString("Mon Apr 14 12:01:10 95", NPT_DateTime::FORMAT_ANSI));
}
/*----------------------------------------------------------------------
|   TestDateFromTimeStringW3C
+---------------------------------------------------------------------*/
static void
TestDateFromTimeStringW3C()
{
    NPT_DateTime date;

    /* Valid date */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10.003Z", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 3000000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date, 2 characters milliseconds */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10.02Z", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 20000000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date, 1 character milliseconds */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10.9Z", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 900000000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date, no millimseconds */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10Z", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date with microseconds, 'Z' */
    SHOULD_SUCCEED(date.FromString("2005-09-06T17:16:10.003498Z", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2005);
    SHOULD_EQUAL_I(date.m_Month        , 9);
    SHOULD_EQUAL_I(date.m_Day          , 6);
    SHOULD_EQUAL_I(date.m_Hours        , 17);
    SHOULD_EQUAL_I(date.m_Minutes      , 16);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 3498000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 0);

    /* Valid date, no milliseconds, with timezone offset */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10+03:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , 180);

    /* Valid date, no milliseconds, with negative m_TimeZone offset */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10-05:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 0);
    SHOULD_EQUAL_I(date.m_TimeZone     , -300);

    /* Valid date, with milliseconds, with positive m_TimeZone offset */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10.200+03:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 200000000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 180);

    /* Valid date, with milliseconds, with negative m_TimeZone offset */
    SHOULD_SUCCEED(date.FromString("2006-04-14T12:01:10.030-05:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2006);
    SHOULD_EQUAL_I(date.m_Month        , 4);
    SHOULD_EQUAL_I(date.m_Day          , 14);
    SHOULD_EQUAL_I(date.m_Hours        , 12);
    SHOULD_EQUAL_I(date.m_Minutes      , 1);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 30000000);
    SHOULD_EQUAL_I(date.m_TimeZone     , -300);

    /* Valid date with microseconds and negative m_TimeZone offset */
    SHOULD_SUCCEED(date.FromString("2005-09-06T17:16:10.001822-05:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2005);
    SHOULD_EQUAL_I(date.m_Month        , 9);
    SHOULD_EQUAL_I(date.m_Day          , 6);
    SHOULD_EQUAL_I(date.m_Hours        , 17);
    SHOULD_EQUAL_I(date.m_Minutes      , 16);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 1822000);
    SHOULD_EQUAL_I(date.m_TimeZone     , -300);
    
    /* Valid date with microseconds and positive m_TimeZone offset */
    SHOULD_SUCCEED(date.FromString("2005-09-06T17:16:10.001822+05:00", NPT_DateTime::FORMAT_W3C));
    SHOULD_EQUAL_I(date.m_Year         , 2005);
    SHOULD_EQUAL_I(date.m_Month        , 9);
    SHOULD_EQUAL_I(date.m_Day          , 6);
    SHOULD_EQUAL_I(date.m_Hours        , 17);
    SHOULD_EQUAL_I(date.m_Minutes      , 16);
    SHOULD_EQUAL_I(date.m_Seconds      , 10);
    SHOULD_EQUAL_I(date.m_NanoSeconds  , 1822000);
    SHOULD_EQUAL_I(date.m_TimeZone     , 300);

    /* Invalid date with 3 digit year */
    SHOULD_FAIL(date.FromString("206-04-14T12:01:10.003Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with 5 digit year */
    SHOULD_FAIL(date.FromString("20076-04-14T12:01:10.003Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with 5 digit year */
    SHOULD_FAIL(date.FromString("20076-04-14T12:01:10.003Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with garbage in the end */
    SHOULD_FAIL(date.FromString("2006-04-14T12:01:10.003+69:696", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad month */
    SHOULD_FAIL(date.FromString("2006-010-14T12:01:10.003", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad month, right overall length */
    SHOULD_FAIL(date.FromString("2063-0--14T12:01:10.003", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad year-month separator */
    SHOULD_FAIL(date.FromString("2063Y08-14T12:01:10.003", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad time separator */
    SHOULD_FAIL(date.FromString("2063-08-14t12:01:10.003", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad hour */
    SHOULD_FAIL(date.FromString("2063-08-14T012:01:10.003", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad GMT indicator */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.003z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad GMT indicator */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.003g", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with millisecond separator but no digits */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with millisecond separator but no digits */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with millisecond separator but no digits */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.+10:38", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad m_TimeZone offset */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10+10:338", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad m_TimeZone offset */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10+001:38", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad m_TimeZone offset */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10+10:33Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad m_TimeZone offset */
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.08+10:33Z", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with bad m_TimeZone offset with m_Seconds*/
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.08+10:33:30", NPT_DateTime::FORMAT_W3C));

    /* Invalid date with m_TimeZone offset too big*/
    SHOULD_FAIL(date.FromString("2063-08-14T12:01:10.08+14:33", NPT_DateTime::FORMAT_W3C));
}