Changeset 16766 in vbox for trunk/src/VBox/Runtime/testcase/tstBase64.cpp
- Timestamp:
- Feb 14, 2009 9:32:04 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstBase64.cpp
r16765 r16766 38 38 #include <iprt/initterm.h> 39 39 40 /******************************************************************************* 41 * Defined Constants And Macros * 42 *******************************************************************************/ 43 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 44 # define MY_NL "\r\n" 45 #else 46 # define MY_NL "\n" 47 #endif 48 40 49 41 50 int main() … … 61 70 TEST_ENTRY("Hey", "SGV5"), 62 71 TEST_ENTRY("Base64", "QmFzZTY0"), 63 TEST_ENTRY("Call me Ishmael.", "Q2FsbCBtZSBJc2htYWVsLg==") 72 TEST_ENTRY("Call me Ishmael.", "Q2FsbCBtZSBJc2htYWVsLg=="), 73 TEST_ENTRY( 74 "Man is distinguished, not only by his reason, but by this singular passion " 75 "from other animals, which is a lust of the mind, that by a perseverance of " 76 "delight in the continued and indefatigable generation of knowledge, exceeds " 77 "the short vehemence of any carnal pleasure." /* Thomas Hobbes's Leviathan */, 78 "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1" MY_NL 79 "dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3" MY_NL 80 "aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFu" MY_NL 81 "Y2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxl" MY_NL 82 "IGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhl" MY_NL 83 "bWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=" 84 ) 64 85 #undef TEST_ENTRY 65 86 }; … … 94 115 } 95 116 96 rc = RTBase64Encode(g_aTests[i].pszText, g_aTests[i].cchText, szOut, g_aTests[i].cchEnc + 1, &cchOut);117 rc = RTBase64Encode(g_aTests[i].pszText, g_aTests[i].cchText, szOut, g_aTests[i].cchEnc*2 + 1, &cchOut); 97 118 if (RT_FAILURE(rc)) 98 119 { … … 124 145 125 146 /* 126 * Bigger Test.147 * Try with some more junk in the encoding and different line length. 127 148 */ 128 149 static const char s_szText2[] = … … 133 154 134 155 static const char s_szEnc2[] = 135 " TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\n"136 " IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\n\r"137 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\n"138 " 139 " ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=\n \n";156 " TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\r\n" 157 " IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\n\r\t\t\t\v" 158 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\n" 159 "\tdWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo\n\r" 160 " ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=\n \n \r \n \t"; 140 161 141 162 int rc = RTBase64Decode(&s_szEnc2[0], szOut, sizeof(s_szText2), &cchOut, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.