| 26 | } |
| 27 | |
| 28 | void base64TestApp::setup() |
| 29 | { |
| 30 | assert( toBase64( "any carnal pleasure." ) == "YW55IGNhcm5hbCBwbGVhc3VyZS4=" ); |
| 31 | assert( toBase64( "any carnal pleasure" ) == "YW55IGNhcm5hbCBwbGVhc3VyZQ==" ); |
| 32 | assert( toBase64( "any carnal pleasur" ) == "YW55IGNhcm5hbCBwbGVhc3Vy" ); |
| 33 | assert( toBase64( "any carnal pleasu" ) == "YW55IGNhcm5hbCBwbGVhc3U=" ); |
| 34 | assert( toBase64( "any carnal pleas" ) == "YW55IGNhcm5hbCBwbGVhcw==" ); |
| 35 | |
| 36 | for( int a = 0; a < 1000; ++a ) { |
| 37 | std::string test; |
| 38 | for( int t = 0; t < a; ++t ) |
| 39 | test += 'A' + ( t % 26 ); |
| 40 | app::console() << "Len: " << a << std::endl; |
| 41 | for( int i = 0; i < 100; ++i ) { // test word wraps |
| 42 | std::string base64 = toBase64( test, i ); |
| 43 | Buffer b = fromBase64(base64); |
| 44 | assert( toString( b ) == test ); |
| 45 | } |
| 46 | } |
| 47 | app::console() << "Tests passed" << std::endl; |
| 48 | } |
| 49 | |
| 50 | void base64TestApp::mouseDown( MouseEvent event ) |
| 51 | { |
nothing calls this directly
no test coverage detected