summaryrefslogtreecommitdiff
path: root/tests/upb_test.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-02-20 08:29:36 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-02-20 08:29:36 -0800
commit0c6786c6fad563f181e66c90df2a74597ce6d18b (patch)
treeabd3277706f54eb91581bee6a0f1c019b4ad52a8 /tests/upb_test.h
parentda95bf34aeacb09fb08fcc6bade6d9e48d32093a (diff)
Split varint decoders into separate .h file.
This makes it easier to benchmark and test the multiple possible implementations of varint decoding.
Diffstat (limited to 'tests/upb_test.h')
-rw-r--r--tests/upb_test.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/upb_test.h b/tests/upb_test.h
new file mode 100644
index 0000000..0e307c5
--- /dev/null
+++ b/tests/upb_test.h
@@ -0,0 +1,27 @@
+/*
+ * upb - a minimalist implementation of protocol buffers.
+ *
+ * Copyright (c) 2011 Joshua Haberman. See LICENSE for details.
+ */
+
+#ifndef UPB_TEST_H_
+#define UPB_TEST_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int num_assertions = 0;
+#define ASSERT(expr) do { \
+ ++num_assertions; \
+ if (!(expr)) { \
+ fprintf(stderr, "Assertion failed: %s:%d\n", __FILE__, __LINE__); \
+ abort(); \
+ } \
+} while(0)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* UPB_DECODER_H_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback