summaryrefslogtreecommitdiff
path: root/sax/qa/cppunit/test_converter.cxx
diff options
context:
space:
mode:
authorArtur Dorda <artur.dorda+libo@gmail.com>2012-08-13 23:14:06 +0200
committerArtur Dorda <artur.dorda+libo@gmail.com>2012-08-15 13:42:19 +0200
commit0456089759cba276c739965651fae8223c640410 (patch)
tree556509ca286969e3f95175f01b31d63dfc898825 /sax/qa/cppunit/test_converter.cxx
parent57cac07a4dc2f447e1ed907dda077b37f015acec (diff)
decodeBase64 test is done and working
Change-Id: I4dfc20e0e577f986c626d4c4bab5b4e3214e4567
Diffstat (limited to 'sax/qa/cppunit/test_converter.cxx')
-rw-r--r--sax/qa/cppunit/test_converter.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 428027ba7c24..e1da1ce395cf 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -518,6 +518,17 @@ void doTestEncodeBase64(char const*const pis, const uno::Sequence<sal_Int8> aPas
OSL_TRACE("%s", ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr());
CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
}
+
+void doTestDecodeBase64(const uno::Sequence<sal_Int8> aPass, char const*const pis)
+{
+ ::rtl::OUString const is(::rtl::OUString::createFromAscii(pis));
+ uno::Sequence< sal_Int8 > tempSequence;
+ Converter::decodeBase64(tempSequence, is);
+ OSL_TRACE("%s", ::rtl::OUStringToOString(is.getStr(), RTL_TEXTENCODING_UTF8).getStr());
+ bool b = (tempSequence==aPass);
+ CPPUNIT_ASSERT(b);
+}
+
void ConverterTest::testBase64()
{
comphelper::SequenceAsVector< sal_Int8 > tempSeq(4);
@@ -525,17 +536,20 @@ void ConverterTest::testBase64()
tempSeq.push_back(i);
uno::Sequence< sal_Int8 > tempSequence = tempSeq.getAsConstList();
doTestEncodeBase64("AAAAAAABAgM=", tempSequence);
+ doTestDecodeBase64(tempSequence, "AAAAAAABAgM=");
tempSeq[0] = sal_Int8(5);
tempSeq[1] = sal_Int8(2);
tempSeq[2] = sal_Int8(3);
tempSequence = tempSeq.getAsConstList();
doTestEncodeBase64("BQIDAAABAgM=", tempSequence);
+ doTestDecodeBase64(tempSequence, "BQIDAAABAgM=");
tempSeq[0] = sal_Int8(200);
tempSeq[1] = sal_Int8(31);
tempSeq[2] = sal_Int8(77);
tempSeq[3] = sal_Int8(111);
tempSequence = tempSeq.getAsConstList();
doTestEncodeBase64("yB9NbwABAgM=", tempSequence);
+ doTestDecodeBase64(tempSequence, "yB9NbwABAgM=");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);