keithn / seatest Goto Github PK
View Code? Open in Web Editor NEWSeatest - Simple C based Unit Testing
License: MIT License
Seatest - Simple C based Unit Testing
License: MIT License
Hi,
In the latest code, if WIN32 is not defined you include "strings.h" (line 12 of seatest.c). My compiler did not come with a "strings.h" file. It only has the standard library "string.h". Should "strings.h" be another include file in seatest repository?
I'm using the evaluation version of the Keil Arm compiler.
Marc
in seatest.hpp 29 ,seatest_simple_test_result should defined more safer like this:
extern void (seatest_simple_test_result)(int passed, char reason, const char* function, unsigned int line);
because it's a global varible, and the real definition is in seatest.c 。 if use seatest in c++, every file who include the seatest.h, will define the seatest_simple_test_result again。and will result the compile error like this:
duplicate symbol _seatest_simple_test_result in:
/var/folders/wy/br32jzv15nqgy1xvn05r4gc80000gn/T/seatest-57864d.o
/var/folders/wy/br32jzv15nqgy1xvn05r4gc80000gn/T/test_main-339523.o
I'm using the svn version on Slackware 13.37 and get this warning:
envvar_tests.c:59:2: warning: passing argument 2 of
‘seatest_assert_string_equal’ discards qualifiers from pointer target type
../seatest/seatest.h:33:6: note: expected ‘char *’ but argument is of type
‘const char *’
I propose to change function prototypes from
void seatest_assert_string_equal(char* expected, char* actual, const char*
function, unsigned int line);
to
void seatest_assert_string_equal(const char* expected, const char* actual,
const char* function, unsigned int line);
Original issue reported on code.google.com by [email protected]
on 17 Feb 2012 at 6:21
When compiling my app with seatest, I get the following compiler error (using
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2):
src/seatest/seatest.c:2:19: fatal error: conio.h: No such file or directory
compilation terminated.
I have attached a patch that corrects this problem, as well as a few other
compiler warnings.
N.B. I have only tested that the patched seatest compiles on my dev machine,
YMMV :-)
Original issue reported on code.google.com by [email protected]
on 26 May 2011 at 11:19
Attachments:
When I use seatest on Ubuntu Linux 9.04 with gcc version 4.4.1 (Ubuntu
4.4.1-4ubuntu8).
GCC will display a warning message as follow
expected ‘char *’ but argument is of type ‘const char *’
I think the each function prototype should be change form
void seatest_simple_test_result(int passed, char* reason, const char* function,
unsigned int line);
to
void seatest_simple_test_result(int passed, char* reason, char* function,
unsigned int line);
Add the "const" keyword for the __FUNCTION__ const
thank you
Original issue reported on code.google.com by [email protected]
on 1 Oct 2010 at 6:47
If I include the following test in the suite I'm building for seatest itself:
assert_test_passes(assert_string_equal((char *)0, (char *)0));
... then I get a segfault, presumably from strcmp().
That behaviour is correct for strcmp, but should SeaTest really error out in
this case?
I _think_ the right behaviour would be to consider null a value in its own
right. The logic could be:
1. fail if one and only one string is null
2. pass if both strings are null
3. run a strcmp if neither string is null
Does that sound sensible?
Original issue reported on code.google.com by [email protected]
on 29 Jun 2011 at 10:58
Currently, Seatest has a Visual Studio project to demonstrate usage.
I'd like to put together a patch including:
- autoconf setup & Makefiles
- any changes necessary to compile demo project as ISO C w/o warnings
... basically everything necessary to build Seatest on *NIX as well as Windows.
I can test it on Linux, Cygwin & possibly Mac OS as well (may have to scrounge
time on a Mac in exchange for beer).
Let me know if this is something you would like.
Original issue reported on code.google.com by [email protected]
on 31 May 2011 at 12:02
This patch adds quotes around expected and actual strings in assert_string_*
functions. It's needed to make whitespace characters at the beginning and end
of strings visible.
P.S. Thanks for seatest.
Original issue reported on code.google.com by [email protected]
on 22 Jun 2011 at 7:27
Attachments:
Hi -
I just pulled down v0.5 from the zip, and am looking at the example projects
(which are very helpful, btw).
It looks like the assert_string_equal assertion is always passing. Here's what
I did:
I took the example/nix test_suite_one file, and changed the first test from:
void test_strings_equal()
{
char *s = "hello";
assert_string_equal("hello", s);
}
To:
{
char *s = "hello";
assert_string_equal("foo", s);
}
Or even:
{
char *s = "hello";
assert_string_equal("foo", "bar");
}
That test will always pass.
I ran make clean build, then ran ./example, and my output is below (notice the
first suite shows 3 run with 0 failures):
---------------- test_suite_one.c ----------------
3 run 0 failed
---------------- test_suite_two.c ----------------
test_assert_fails Line 12 Should of been true
2 run 1 failed
==================SEATEST v0.5====================
Failed
5 tests run
in 0 ms
==================================================
Original issue reported on code.google.com by [email protected]
on 25 Feb 2014 at 10:15
The way run_tests is currently implemented leads to problems with the exit
status of the test run.
The line
return sea_tests_failed == 0;
returns 1 if the comparison succeeds. However, the exit status 1 stands for
failure.
I would propose the following fix:
if (sea_tests_failed == 0) {
return 0;
else {
return -1;
}
Original issue reported on code.google.com by [email protected]
on 17 Aug 2014 at 4:56
Just a minor grammar glitch but it stands out every time I run my tests because
I'm a grammar pedant :-).
Patch attached.
Original issue reported on code.google.com by [email protected]
on 30 May 2011 at 10:34
Attachments:
Hi, there,
In *nix convention, return value 0 means success. But in the Seatest Hello World, it return 1 when success, which is a little surprise to caller. Is any better choice for Seatest Hello World other than return 1?
For:
void seatest_assert_true(int test, const char* function, unsigned int line)
{
seatest_simple_test_result(test, "Should have been true", function, line);
}
void seatest_assert_false(int test, const char* function, unsigned int line)
{
seatest_simple_test_result(!test, "Should have been false", function, line);
}
The text was corrected. A minor detail ;)
Thanks a lot for this testing library, it's very useful !
Original issue reported on code.google.com by [email protected]
on 25 Nov 2013 at 7:16
strings when asserted, if they are over 100 characters will cause grief.
*rolls eyes* such a noob....
Original issue reported on code.google.com by [email protected]
on 13 Jul 2010 at 4:40
main.cpp:2:18: fatal error: conio.h: No such file or directory
compilation terminated.
Original issue reported on code.google.com by [email protected]
on 11 Sep 2013 at 6:51
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.