Thread: Anybody know how to stop check resetting my globals between tests?

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,574

    Anybody know how to stop check resetting my globals between tests?

    In my ouput I check via the test of alu_setup_reg() how many nodes have been assigned, I then check on the following test that I still have those nodes (which I should as I do not free them)
    Code:
    ../tests/check_alu.c:203: test_alu_setup_reg_fn() alu_upto() = 64
    ../tests/check_alu.c:541:F:Core:test_alu_get_reg_node:0: Assertion '((alu)->given) > 0' failed
    This is how I learned check has been interfering with my tests by clearing my global data despite it being declared BEFORE including check.h, is there anyone who knows how to stop this behavior or work around it?

    Edit: Here's a link to their github page: GitHub - libcheck/check: A unit testing framework for C

  2. #2
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,574
    Managed to get some help via their issue tracker,
    Code:
    srunner_set_fork_status(sr,CK_NOFORK);
    fixed it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Globals?
    By memcpy in forum C Programming
    Replies: 2
    Last Post: 12-12-2011, 09:37 PM
  2. Stop button doesnt stop a function (using PostMessage)
    By scwizzo in forum Windows Programming
    Replies: 7
    Last Post: 03-07-2008, 07:54 PM
  3. On globals of different modules.
    By BrownB in forum C Programming
    Replies: 1
    Last Post: 07-16-2004, 11:55 AM
  4. globals
    By ygfperson in forum C Programming
    Replies: 3
    Last Post: 08-19-2002, 02:49 PM
  5. static globals...
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 02-19-2002, 11:28 PM

Tags for this Thread