RFC 4648 Test Vectors
This commit is contained in:
		
							parent
							
								
									6cd3b8bc00
								
							
						
					
					
						commit
						822bb97a5f
					
				| @ -14,6 +14,9 @@ | ||||
| #include <cstdint> | ||||
| #include <climits> | ||||
| 
 | ||||
| // RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
 | ||||
| // See: https://tools.ietf.org/html/rfc4648
 | ||||
| 
 | ||||
| namespace osrm | ||||
| { | ||||
| namespace engine | ||||
|  | ||||
| @ -3,8 +3,23 @@ | ||||
| #include <boost/test/unit_test.hpp> | ||||
| #include <boost/test/test_case_template.hpp> | ||||
| 
 | ||||
| // RFC 4648 "The Base16, Base32, and Base64 Data Encodings"
 | ||||
| BOOST_AUTO_TEST_SUITE(base64) | ||||
| 
 | ||||
| // For test vectors see section 10: https://tools.ietf.org/html/rfc4648#section-10
 | ||||
| BOOST_AUTO_TEST_CASE(rfc4648_test_vectors) | ||||
| { | ||||
|     using namespace osrm::engine; | ||||
| 
 | ||||
|     BOOST_CHECK_EQUAL(encodeBase64(""), ""); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("f"), "Zg=="); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("fo"), "Zm8="); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("foo"), "Zm9v"); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("foob"), "Zm9vYg=="); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("fooba"), "Zm9vYmE="); | ||||
|     BOOST_CHECK_EQUAL(encodeBase64("foobar"), "Zm9vYmFy"); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(encoding) {} | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(decoding) {} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user