Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable some unit tests for MinGW #99

Closed
wants to merge 13 commits into from
15 changes: 9 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ version: 1.0.{build}

environment:
matrix:
- platform: msvc
- platform: vs
- platform: cygwin
# - platform: msvc
# - platform: vs
# - platform: cygwin
- platform: mingw32
- platform: mingw64msys
# - platform: mingw64msys

# scripts that are called at very beginning, before repo cloning
# init:
Expand All @@ -36,6 +36,10 @@ clone_folder: c:\projects\check
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

#---------------------------------#
# build configuration #
Expand Down Expand Up @@ -77,6 +81,5 @@ test_script:
- if %platform%==vs ctest --extra-verbose -C Release
# Unit tests on Cygwin currently do not all pass
#- if %platform%==cygwin bash -c "make check || cat tests/test-suite.log && false"
# check_check does not work on MinGW
#- if %platform%==mingw32 tests\check_check.exe
- if %platform%==mingw32 tests\ex_output.exe CK_NORMAL STDOUT NORMAL
- if %platform%==mingw64msys bash -c "tests/check_check"
27 changes: 27 additions & 0 deletions tests/ex_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,31 @@ static void print_usage(void)
printf(" then use the following mode: CK_SILENT STDOUT [NORMAL|EXIT_TEST].\n");
}

void do_the_print(const char *expr, ...)
{
const char *msg;
va_list ap;
char buf[BUFSIZ];
printf("BUFSIZ: %d\n", BUFSIZ);

va_start(ap, expr);

vsnprintf(buf, BUFSIZ, expr, ap);
printf("%s\n", buf);

va_end(ap);
}

#define example_macro(X, OP, Y, TP, TM) do { \
TP _ck_x = (X); \
TP _ck_y = (Y); \
int MY_FLOATING_DIG = 6; \
do_the_print("Assertion '%s' failed: %s == %.*"TM"g, %s == %.*"TM"g", \
#X" "#OP" "#Y, \
#X, (int)MY_FLOATING_DIG, _ck_x, \
#Y, (int)MY_FLOATING_DIG, _ck_y); \
} while (0)

static void run_tests(enum print_output printmode, char *log_type, int include_exit_test)
{
SRunner *sr;
Expand Down Expand Up @@ -225,6 +250,8 @@ int main(int argc, char **argv)
enum print_output printmode;
int include_exit_test;

example_macro((double)1/(double)3, ==, 1.5, double, "l");

if(argc != 4)
{
print_usage();
Expand Down