Author | Jamozed <[email protected]> |
Date | 2021-02-20 07:35:37 |
Commit | 346e60fbca65f09bb0a38db84cb3237d3da935e9 |
Parent | 9e513ff3f61acf440fe77875e05f90ba864dbccc |
base64: Remove redundant unit tests
Diffstat
M | src/test/test_base64.c | | | 62 | ++++++++++++-------------------------------------------------- |
1 files changed, 12 insertions, 50 deletions
diff --git a/src/test/test_base64.c b/src/test/test_base64.c index 79fefd2..eecc712 100644 --- a/src/test/test_base64.c +++ b/src/test/test_base64.c @@ -71,79 +71,41 @@ int main(void) { } { - uint8_t i[9] = { 0x9B, 0x65, 0x37, 0xF9, 0x9C, 0x88, 0xF0, 0x4D, 0x66 }; - uint8_t o[12] = { 0 }; - - b64encode(o, i, 1); - ASSERT("T010 ENCODE RANDOM DATA LENGTH 1", - !memcmp(o, "mw==", 4)); - - b64encode(o, i, 2); - ASSERT("T011 ENCODE RANDOM DATA LENGTH 2", - !memcmp(o, "m2U=", 4)); - - b64encode(o, i, 3); - ASSERT("T012 ENCODE RANDOM DATA LENGTH 3", - !memcmp(o, "m2U3", 4)); - - b64encode(o, i, 4); - ASSERT("T013 ENCODE RANDOM DATA LENGTH 4", - !memcmp(o, "m2U3+Q==", 8)); - - b64encode(o, i, 5); - ASSERT("T014 ENCODE RANDOM DATA LENGTH 5", - !memcmp(o, "m2U3+Zw=", 8)); - - b64encode(o, i, 6); - ASSERT("T015 ENCODE RANDOM DATA LENGTH 6", - !memcmp(o, "m2U3+ZyI", 8)); - - b64encode(o, i, 7); - ASSERT("T016 ENCODE RANDOM DATA LENGTH 7", - !memcmp(o, "m2U3+ZyI8A==", 12)); - - b64encode(o, i, 8); - ASSERT("T017 ENCODE RANDOM DATA LENGTH 8", - !memcmp(o, "m2U3+ZyI8E0=", 12)); - - b64encode(o, i, 9); - ASSERT("T018 ENCODE RANDOM DATA LENGTH 9", - !memcmp(o, "m2U3+ZyI8E1m", 12)); - } - - { - uint8_t i[12] = "MTIzNDU2Nw=="; uint8_t o[10] = { 0 }; + uint8_t i[12] = "MTIzNDU2Nw=="; + uint8_t o[10] = { 0 }; b64decode(o, i, 10); - ASSERT("T019 DECODE STRING LENGTH 10", + ASSERT("T010 DECODE STRING LENGTH 10", !memcmp(o, "1234567", 7)); b64decode(o, i, 11); - ASSERT("T020 DECODE STRING LENGTH 10 HALF PADDED", + ASSERT("T011 DECODE STRING LENGTH 10 HALF PADDED", !memcmp(o, "1234567", 7)); b64decode(o, i, 12); - ASSERT("T021 DECODE STRING LENGTH 10 PADDED", + ASSERT("T012 DECODE STRING LENGTH 10 PADDED", !memcmp(o, "1234567", 7)); } { - uint8_t i[12] = "MTIzNDU2Nzg="; uint8_t o[10] = { 0 }; + uint8_t i[12] = "MTIzNDU2Nzg="; + uint8_t o[10] = { 0 }; b64decode(o, i, 11); - ASSERT("T023 DECODE STRING LENGTH 11", + ASSERT("T013 DECODE STRING LENGTH 11", !memcmp(o, "12345678", 8)); b64decode(o, i, 12); - ASSERT("T024 DECODE STRING LENGTH 10 PADDED", + ASSERT("T014 DECODE STRING LENGTH 11 PADDED", !memcmp(o, "12345678", 8)); } { - uint8_t i[12] = "MTIzNDU2Nzg5"; uint8_t o[10] = { 0 }; + uint8_t i[12] = "MTIzNDU2Nzg5"; + uint8_t o[10] = { 0 }; b64decode(o, i, 12); - ASSERT("T025 DECODE STRING LENGTH 12", + ASSERT("T015 DECODE STRING LENGTH 12", !memcmp(o, "123456789", 9)); }