Remove gtest
It would be useful to be able to run libcper decoding unit tests without
needing a C compiler, as would be required if this were compiled to a
python module.
Change-Id: I183bc9ef048c336205186ea449e15b7766b19990
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/base64_test.c b/tests/base64_test.c
new file mode 100644
index 0000000..abc540c
--- /dev/null
+++ b/tests/base64_test.c
@@ -0,0 +1,27 @@
+#include <libcper/base64.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+void test_base64_encode_good()
+{
+ int32_t encoded_len = 0;
+ const char *data = "f";
+ char *encoded = base64_encode((unsigned char *)data, strlen(data),
+ &encoded_len);
+ assert(encoded_len == 4);
+ assert(memcmp(encoded, "Zg==", encoded_len) == 0);
+ free(encoded);
+}
+
+void test_base64_decode_good()
+{
+ int32_t decoded_len = 0;
+ const char *data = "Zg==";
+ UINT8 *decoded = base64_decode(data, strlen(data), &decoded_len);
+ assert(decoded_len == 1);
+ assert(decoded[0] == 'f');
+ free(decoded);
+}