+void Base64TestCase::DecodeInvalid()
+{
+ size_t rc, posErr;
+ rc = wxBase64Decode(NULL, 0, "one two!", wxNO_LEN,
+ wxBase64DecodeMode_Strict, &posErr);
+ CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc);
+ CPPUNIT_ASSERT_EQUAL( 3, posErr );
+
+ rc = wxBase64Decode(NULL, 0, "one two!", wxNO_LEN,
+ wxBase64DecodeMode_SkipWS, &posErr);
+ CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc);
+ CPPUNIT_ASSERT_EQUAL( 7, posErr );
+
+ rc = wxBase64Decode(NULL, 0, "? QQ==", wxNO_LEN,
+ wxBase64DecodeMode_SkipWS, &posErr);
+ CPPUNIT_ASSERT_EQUAL( wxCONV_FAILED, rc);
+ CPPUNIT_ASSERT_EQUAL( 0, posErr );
+
+ posErr = (size_t)-1;
+ rc = wxBase64Decode(NULL, 0, " QQ==", wxNO_LEN,
+ wxBase64DecodeMode_SkipWS, &posErr);
+ CPPUNIT_ASSERT_EQUAL( 1, rc );
+ CPPUNIT_ASSERT_EQUAL( -1, posErr );
+
+ rc = wxBase64Decode(NULL, 0, "? QQ==", wxNO_LEN,
+ wxBase64DecodeMode_Relaxed, &posErr);
+ CPPUNIT_ASSERT_EQUAL( 1, rc );
+ CPPUNIT_ASSERT_EQUAL( -1, posErr );
+
+ CPPUNIT_ASSERT( !wxBase64Decode("wxGetApp()").GetDataLen() );
+}
+