Browse Source

add unit test

master
Felix von Leitner 3 years ago
parent
commit
2c4e279f1e
  1. 12
      str/str_diff.c

12
str/str_diff.c

@ -21,3 +21,15 @@ int str_diff(const char* a, const char* b) {
}
return j;
}
#ifdef UNITTEST
#include <assert.h>
#include <string.h>
int main() {
assert(str_diff("foo","foo")==0);
assert(str_diff("foo","fob")==('o'-'b'));
assert(str_diff("foo","foox")==(-'x'));
assert(str_diff("foox","foo")=='x');
}
#endif

Loading…
Cancel
Save