return res;
}
+
+int u_strncmp(const char *s1, const char *s2, u32 n) {
+ return strncmp(s1, s2, n);
+}
struct t_command buffer[T_COMMANDS_MAX];
};
-extern struct t_command_queue t_command_queue;
/* runs the command queue
* returns number of commands run
#endif
+/**
+ * To only run specific test-cases
+ * run with test names as cli argumentst
+ * e.g. ./test arena
+ * will only run arena test
+ */
int main(int argc, char **argv) {
p_io_init();
T_TESTCASE("fixed-point-macro", t_test_fp_macros);
T_TESTCASE("fixed-point-sqrt", t_test_fp_sqrt);
- T_TESTCASE("command push", test_t_command_push);
+ T_TESTCASE("command-push", test_t_command_push);
T_TESTEND("lrts test");
* Test functions should return 0 when they succeed otherwise 1
*/
#define T_TESTCASE(name, fn) { \
- T_TESTBEGIN(name); \
- if (fn() == 0) {\
- u_fprintf(u_stderr, "%s OK\n", name); \
- } else {\
- u_fprintf(u_stderr, "%s FAIL\n", name); \
- }\
- T_TESTEND(name); \
+ i32 i; \
+ struct lrts_config *c = lrts_cfg(); \
+ lrts_bool skip = c->argc != 0; \
+ for (i = 0; i < c->argc; i++) { \
+ if (u_strncmp(name, c->argv[i], strlen(name)) == 0) { \
+ skip = LRTS_FALSE; \
+ break; \
+ } \
+ } \
+ if (!skip) { \
+ T_TESTBEGIN(name); \
+ if (fn() == 0) {\
+ u_fprintf(u_stderr, "%s OK\n", name); \
+ } else {\
+ u_fprintf(u_stderr, "%s FAIL\n", name); \
+ }\
+ T_TESTEND(name); \
+ } \
}
#endif
int u_vsprintf(char *buffer, const char *fmt, va_list args);
int u_sprintf(char *buffer, const char *fmt, ...);
+int u_strncmp(const char *s1, const char *s2, u32 n);
+
#endif