diff options
author | Alfred E. Heggestad <aeh@db.org> | 2015-08-09 15:28:08 +0200 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2015-08-09 15:28:08 +0200 |
commit | 0535a3244acc2a6c096703090b467e60e630cf60 (patch) | |
tree | d5ea6873d5c092c7494818581253a7d03b4c14e0 /test/test.h | |
parent | 7d43d386d03047f4f1a3b5abbb4f4ecf81eb650b (diff) |
selftest: new binary
- move selftest code from module/selftest to test/.
- create a new binary called 'selftest'
- the selftest is testing the Baresip Core only
Diffstat (limited to 'test/test.h')
-rw-r--r-- | test/test.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/test.h b/test/test.h new file mode 100644 index 0000000..20807b6 --- /dev/null +++ b/test/test.h @@ -0,0 +1,58 @@ +/** + * @file test.h Selftest for Baresip core -- internal API + * + * Copyright (C) 2010 Creytiv.com + */ + + +#define ASSERT_TRUE(cond) \ + if (!(cond)) { \ + warning("selftest: ASSERT_TRUE: %s:%u:\n", \ + __FILE__, __LINE__); \ + err = EINVAL; \ + goto out; \ + } + +#define ASSERT_EQ(expected, actual) \ + if ((expected) != (actual)) { \ + warning("selftest: ASSERT_EQ: %s:%u:" \ + " expected=%d, actual=%d\n", \ + __FILE__, __LINE__, \ + (int)(expected), (int)(actual)); \ + err = EINVAL; \ + goto out; \ + } + +#define ASSERT_STREQ(expected, actual) \ + if (0 != str_cmp((expected), (actual))) { \ + warning("selftest: ASSERT_STREQ: %s:%u:" \ + " expected = '%s', actual = '%s'\n", \ + __FILE__, __LINE__, \ + (expected), (actual)); \ + err = EBADMSG; \ + goto out; \ + } + + +/* helpers */ + +int re_main_timeout(uint32_t timeout); + +struct sip_server { + struct sa laddr; + struct udp_sock *us; + struct sip *sip; + + bool got_register_req; + bool terminate; +}; + +int sip_server_create(struct sip_server **srvp); + + +/* test cases */ + +int test_cmd(void); +int test_ua_alloc(void); +int test_uag_find_param(void); +int test_ua_register(void); |