-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
just picking any actively maintained embeddable framework to write a bunch of tests with. will swap it out if I hate it. this single initial test found a big one....
- Loading branch information
Showing
3 changed files
with
1,470 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PREFIX=/usr/local | ||
|
||
all: | ||
gcc -g -Wall -Werror -pedantic -o main main.c ../mcmc.c | ||
|
||
clean: | ||
rm -f main main.o | ||
|
||
dist: clean | ||
|
||
distdir: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "utest.h" | ||
#include "../mcmc.h" | ||
|
||
struct tmc_fixt { | ||
void *ctx; | ||
}; | ||
|
||
UTEST_F_SETUP(tmc_fixt) { | ||
utest_fixture->ctx = calloc(1, mcmc_size(MCMC_OPTION_BLANK)); | ||
ASSERT_TRUE(utest_fixture->ctx); | ||
} | ||
|
||
UTEST_F_TEARDOWN(tmc_fixt) { | ||
free(utest_fixture->ctx); | ||
} | ||
|
||
UTEST_F(tmc_fixt, trial) { | ||
mcmc_resp_t r; | ||
char goodbuf[] = "VALUE foo 0 2\r\nhi\r\n"; | ||
char badbuf[] = "bad response\r\n"; | ||
int res = mcmc_parse_buf(utest_fixture->ctx, goodbuf, strlen(goodbuf), &r); | ||
ASSERT_GE(res, MCMC_OK); | ||
|
||
res = mcmc_parse_buf(utest_fixture->ctx, badbuf, strlen(badbuf), &r); | ||
ASSERT_LT(res, MCMC_OK); | ||
} | ||
|
||
UTEST_MAIN() |
Oops, something went wrong.