Blame tests/check_check_master.c

Packit 0b5880
/*
Packit 0b5880
 * Check: a unit test framework for C
Packit 0b5880
 * Copyright (C) 2001, 2002 Arien Malec
Packit 0b5880
 *
Packit 0b5880
 * This library is free software; you can redistribute it and/or
Packit 0b5880
 * modify it under the terms of the GNU Lesser General Public
Packit 0b5880
 * License as published by the Free Software Foundation; either
Packit 0b5880
 * version 2.1 of the License, or (at your option) any later version.
Packit 0b5880
 *
Packit 0b5880
 * This library is distributed in the hope that it will be useful,
Packit 0b5880
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0b5880
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 0b5880
 * Lesser General Public License for more details.
Packit 0b5880
 *
Packit 0b5880
 * You should have received a copy of the GNU Lesser General Public
Packit 0b5880
 * License along with this library; if not, write to the
Packit 0b5880
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
Packit 0b5880
 * MA 02110-1301, USA.
Packit 0b5880
 */
Packit 0b5880
Packit 0b5880
#include "../lib/libcompat.h"
Packit 0b5880
Packit 0b5880
#include <stdlib.h>
Packit 0b5880
#include <stdio.h>
Packit 0b5880
#include <string.h>
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
# include <regex.h>
Packit 0b5880
#endif
Packit 0b5880
#include <check.h>
Packit 0b5880
#include <assert.h>
Packit 0b5880
#include "check_check.h"
Packit 0b5880
Packit 0b5880
int sub_nfailed;
Packit 0b5880
int sub_ntests;
Packit 0b5880
Packit 0b5880
TestResult **tr_fail_array;
Packit 0b5880
TestResult **tr_all_array;
Packit 0b5880
Packit 0b5880
FILE * test_names_file = NULL;
Packit 0b5880
char * test_names_file_name = NULL;
Packit 0b5880
FILE * line_num_failures = NULL;
Packit 0b5880
char * line_num_failures_file_name = NULL;
Packit 0b5880
Packit 0b5880
enum ck_test_msg_type_t {
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  // For tests with different output on different platforms
Packit 0b5880
  CK_MSG_REGEXP,
Packit 0b5880
#endif
Packit 0b5880
  // Simple text
Packit 0b5880
  CK_MSG_TEXT
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
#define MAXSTR 300
Packit 0b5880
Packit 0b5880
typedef struct {
Packit 0b5880
  const char *tcname;
Packit 0b5880
  const char *test_name;
Packit 0b5880
  int failure_type;
Packit 0b5880
  enum ck_test_msg_type_t msg_type;
Packit 0b5880
  const char *msg;
Packit 0b5880
} master_test_t;
Packit 0b5880
Packit 0b5880
#define SIG_STR_LEN 128
Packit 0b5880
static char signal_11_str[SIG_STR_LEN];
Packit 0b5880
static char signal_11_8_str[SIG_STR_LEN];
Packit 0b5880
static char signal_8_str[SIG_STR_LEN];
Packit 0b5880
Packit 0b5880
static master_test_t master_tests[] = {
Packit 0b5880
  { "Simple Tests", "test_lno", CK_FAILURE, CK_MSG_TEXT, "Failure expected" },
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
  { "Simple Tests", "test_mark_lno", CK_ERROR, CK_MSG_TEXT,   "Early exit with return value 1" },
Packit 0b5880
#endif
Packit 0b5880
  { "Simple Tests", "test_pass", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Simple Tests", "test_fail_unless", CK_FAILURE, CK_MSG_TEXT, "This test should fail" },
Packit 0b5880
  { "Simple Tests", "test_fail_if_pass", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Simple Tests", "test_fail_if_fail", CK_FAILURE, CK_MSG_TEXT, "This test should fail" },
Packit 0b5880
  { "Simple Tests", "test_fail_null_msg", CK_FAILURE, CK_MSG_TEXT, "Assertion '2 == 3' failed" },
Packit 0b5880
#if defined(__GNUC__)
Packit 0b5880
  { "Simple Tests", "test_fail_no_msg", CK_FAILURE, CK_MSG_TEXT, "Assertion '4 == 5' failed" },
Packit 0b5880
#endif /* __GNUC__ */
Packit 0b5880
  { "Simple Tests", "test_fail_if_null_msg", CK_FAILURE, CK_MSG_TEXT, "Failure '2 != 3' occurred" },
Packit 0b5880
#if defined(__GNUC__)
Packit 0b5880
  { "Simple Tests", "test_fail_if_no_msg", CK_FAILURE, CK_MSG_TEXT, "Failure '4 != 5' occurred" },
Packit 0b5880
#endif /* __GNUC__ */
Packit 0b5880
  { "Simple Tests", "test_fail_vararg_msg_1", CK_FAILURE, CK_MSG_TEXT, "3 != 4" },
Packit 0b5880
  { "Simple Tests", "test_fail_vararg_msg_2", CK_FAILURE, CK_MSG_TEXT, "5 != 6" },
Packit 0b5880
  { "Simple Tests", "test_fail_vararg_msg_3", CK_FAILURE, CK_MSG_TEXT, "7 == 7" },
Packit 0b5880
#if defined(__GNUC__)
Packit 0b5880
  { "Simple Tests", "test_fail_empty", CK_FAILURE, CK_MSG_TEXT, "Failed" },
Packit 0b5880
#endif /* __GNUC__ */
Packit 0b5880
  { "Simple Tests", "test_ck_abort", CK_FAILURE, CK_MSG_TEXT, "Failed" },
Packit 0b5880
  { "Simple Tests", "test_ck_abort_msg", CK_FAILURE, CK_MSG_TEXT, "Failure expected" },
Packit 0b5880
  { "Simple Tests", "test_ck_abort_msg_null", CK_FAILURE, CK_MSG_TEXT, "Failed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_null", CK_FAILURE, CK_MSG_TEXT, "Assertion '0' failed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%f == 1' failed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 3, y == 4" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_eq_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d == 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != y' failed: x == 3, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_ne_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d != 3%f' failed: 3%d == 1, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x < x' failed: x == 2, x == 2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_lt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d < 3%f' failed: 3%d == 1, 3%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y <= x' failed: y == 3, x == 2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_le_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y > y' failed: y == 3, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_gt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d > 3%f' failed: 3%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y' failed: x == 2, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_ge_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d >= 4%f' failed: 3%d == 0, 4%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_int_expr", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 3, y == 4" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_eq_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d == 1%f' failed: 3%d == 1, 1%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != y' failed: x == 3, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_ne_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d != 1%f' failed: 1%d == 0, 1%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x < x' failed: x == 2, x == 2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_lt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d < 1%f' failed: 3%d == 1, 1%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y <= x' failed: y == 3, x == 2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_le_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 1%f' failed: 3%d == 1, 1%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y > y' failed: y == 3, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_gt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d > 3%f' failed: 1%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y' failed: x == 2, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_ge_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d >= 3%f' failed: 1%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_uint_expr", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  /* Tests on float macros */
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 1.1, y == 1.2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_eq_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d == 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != y' failed: x == 1.1, y == 1.1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ne_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d != 1%f' failed: 1%d == 1, 1%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x < y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_lt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d < 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x <= y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_le_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x > y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_gt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d > 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ge_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_eq_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) < t' failed: x == 0.001, y == 0.003, t == 0.001" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_eq_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(2%f - 3%d) < 2%p' failed: 3%d == 1, 2%f == 0, 2%p == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ne_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) >= t' failed: x == 0.001, y == 0.002, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ne_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(3%f - 3%d) >= 3%p' failed: 3%d == 1, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ge_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y, error < t' failed: x == 0.01, y == 0.03, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_ge_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f, error < 3%p' failed: 2%d == 0, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_le_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y <= x, error < t' failed: y == 0.03, x == 0.01, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_le_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f, error < 3%p' failed: 3%d == 1, 2%f == 0, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_tol_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_finite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is finite' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_finite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x*(1%d) is finite' failed: x*(1%d) == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_infinite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is infinite' failed: x == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_infinite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is infinite' failed: 2%d == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nan", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is NaN' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nan_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is NaN' failed: 2%d == 0" },
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nonnan", CK_FAILURE, CK_MSG_REGEXP, "^Assertion 'x is not NaN' failed: x == -?nan$" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nonnan_with_mod", CK_FAILURE, CK_MSG_REGEXP, "^Assertion '\\(2%s\\)\\*x is not NaN' failed: \\(2%s\\)\\*x == -?nan$" },
Packit 0b5880
#else
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nonnan", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nonnan_with_mod", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
#endif
Packit 0b5880
  { "Simple Tests", "test_ck_assert_float_nan_and_inf_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  /* End of tests on float macros */
Packit 0b5880
  /* Tests on double macros */
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 1.1, y == 1.2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d == 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq_with_promotion", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq_with_conv", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == 0.1' failed: x == 0.1, 0.1 == 0.1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != y' failed: x == 1.1, y == 1.1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ne_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d != 1%f' failed: 1%d == 1, 1%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x < y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_lt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d < 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x <= y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_le_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x > y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_gt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d > 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ge_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) < t' failed: x == 0.001, y == 0.002, t == 0.001" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_eq_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(2%f - 3%d) < 2%p' failed: 3%d == 1, 2%f == 0, 2%p == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ne_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) >= t' failed: x == 0.001, y == 0.002, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ne_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(3%f - 3%d) >= 3%p' failed: 3%d == 1, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ge_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y, error < t' failed: x == 0.01, y == 0.03, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_ge_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f, error < 3%p' failed: 2%d == 0, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_le_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y <= x, error < t' failed: y == 0.03, x == 0.01, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_le_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f, error < 3%p' failed: 3%d == 1, 2%f == 0, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_tol_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_finite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is finite' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_finite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x*(1%d) is finite' failed: x*(1%d) == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_infinite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is infinite' failed: x == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_infinite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is infinite' failed: 2%d == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nan", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is NaN' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nan_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is NaN' failed: 2%d == 0" },
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nonnan", CK_FAILURE, CK_MSG_REGEXP, "^Assertion 'x is not NaN' failed: x == -?nan$" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nonnan_with_mod", CK_FAILURE, CK_MSG_REGEXP, "^Assertion '\\(2%s\\)\\*x is not NaN' failed: \\(2%s\\)\\*x == -?nan$" },
Packit 0b5880
#else
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nonnan", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nonnan_with_mod", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
#endif
Packit 0b5880
  { "Simple Tests", "test_ck_assert_double_nan_and_inf_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  /* End of tests on double macros */
Packit 0b5880
  /* Tests on long double macros */
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 1.1, y == 1.2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_eq_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d == 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_eq_with_promotion", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_eq_with_conv", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == 1.1' failed: x == 1.1, 1.1 == 1.1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != y' failed: x == 1.1, y == 1.1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ne_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '1%d != 1%f' failed: 1%d == 1, 1%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x < y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_lt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d < 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x <= y' failed: x == 2, y == 1.5" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_le_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f' failed: 3%d == 1, 2%f == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x > y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_gt_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d > 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y' failed: x == 2.5, y == 3" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ge_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f' failed: 2%d == 0, 3%f == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit Service 6781b3
  { "Simple Tests", "test_ck_assert_ldouble_eq_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) < t' failed: x == 0.001, y == 0.002, t == 0.0009" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_eq_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(2%f - 3%d) < 2%p' failed: 3%d == 1, 2%f == 0, 2%p == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ne_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(y - x) >= t' failed: x == 0.001, y == 0.002, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ne_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'fabsl(3%f - 3%d) >= 3%p' failed: 3%d == 1, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ge_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x >= y, error < t' failed: x == 0.01, y == 0.03, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_ge_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d >= 3%f, error < 3%p' failed: 2%d == 0, 3%f == 1, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_le_tol", CK_FAILURE, CK_MSG_TEXT, "Assertion 'y <= x, error < t' failed: y == 0.03, x == 0.01, t == 0.01" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_le_tol_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '3%d <= 2%f, error < 3%p' failed: 3%d == 1, 2%f == 0, 3%p == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_tol_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_finite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is finite' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_finite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x*(1%d) is finite' failed: x*(1%d) == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_infinite", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is infinite' failed: x == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_infinite_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is infinite' failed: 2%d == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nan", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x is NaN' failed: x == inf" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nan_with_mod", CK_FAILURE, CK_MSG_TEXT, "Assertion '2%d is NaN' failed: 2%d == 0" },
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nonnan", CK_FAILURE, CK_MSG_REGEXP, "^Assertion 'x is not NaN' failed: x == -?nan$" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nonnan_with_mod", CK_FAILURE, CK_MSG_REGEXP, "^Assertion '\\(2%s\\)\\*x is not NaN' failed: \\(2%s\\)\\*x == -?nan$" },
Packit 0b5880
#else
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nonnan", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nonnan_with_mod", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
#endif
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ldouble_nan_and_inf_with_expr", CK_PASS, CK_MSG_TEXT, "Passed" },
Packit 0b5880
  /* End of tests on long double macros */
Packit 0b5880
  { "Simple Tests", "test_percent_n_escaped", CK_FAILURE, CK_MSG_TEXT, "Assertion 'returnsZero(\"%n\") == 1' failed: returnsZero(\"%n\") == 0, 1 == 1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion '\"test1\" == s' failed: \"test1\" == \"test1\", s == \"test2\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_eq_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't == s' failed: t == (null), s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 't != s' failed: t == \"test2\", s == \"test2\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_ne_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't != s' failed: t == \"test\", s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 's < s' failed: s == \"test1\", s == \"test1\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_lt_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 's < t' failed: s == (null), t == \"test\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 't <= s' failed: t == \"test2\", s == \"test1\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_le_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't <= s' failed: t == (null), s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 't > t' failed: t == \"test2\", t == \"test2\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_gt_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't > s' failed: t == \"test\", s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 's >= t' failed: s == \"test1\", t == \"test2\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_ge_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 's >= t' failed: s == (null), t == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_str_expr", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_pstr_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion '\"test1\" == s' failed: \"test1\" == \"test1\", s == \"test\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_pstr_eq_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't == s' failed: t == \"test\", s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_pstr_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 't != s' failed: t == \"test2\", s == \"test2\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_pstr_ne_with_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 't != s' failed: t == (null), s == (null)" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ptr_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == y' failed: x == 0x1, y == 0x2" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ptr_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != z' failed: x == 0x1, z == 0x1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ptr_null", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x == NULL' failed: x == 0x1" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_ptr_nonnull", CK_FAILURE, CK_MSG_TEXT, "Assertion 'x != NULL' failed: x == 0" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_eq", CK_FAILURE, CK_MSG_TEXT, "Assertion '\"\\x00\\x00\\x00\\x00\\x01\" == s' failed: \"\\x00\\x00\\x00\\x00\\x01\" == \"0000000001\", s == \"0000000002\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_ne", CK_FAILURE, CK_MSG_TEXT, "Assertion 't != s' failed: t == \"0000000002\", s == \"0000000002\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_lt", CK_FAILURE, CK_MSG_TEXT, "Assertion 's < s' failed: s == \"0000000001\", s == \"0000000001\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_le", CK_FAILURE, CK_MSG_TEXT, "Assertion 't <= s' failed: t == \"0000000002\", s == \"0000000001\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_gt", CK_FAILURE, CK_MSG_TEXT, "Assertion 't > t' failed: t == \"0000000002\", t == \"0000000002\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_ge", CK_FAILURE, CK_MSG_TEXT, "Assertion 's >= t' failed: s == \"0000000001\", t == \"0000000002\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_zerolen", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_eq_exact", CK_FAILURE, CK_MSG_TEXT, "Assertion 't == s' failed: t == \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\", s == \"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002\"" },
Packit 0b5880
  { "Simple Tests", "test_ck_assert_mem_eq_longer", CK_FAILURE, CK_MSG_TEXT, "Assertion 't == s' failed: t == \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000..\", s == \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000..\"" },
Packit 0b5880
  
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
  { "Signal Tests", "test_segv", CK_ERROR, CK_MSG_TEXT,   signal_11_str },
Packit 0b5880
  { "Signal Tests", "test_segv_pass", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Signal Tests", "test_segv", CK_ERROR, CK_MSG_TEXT,   signal_11_8_str },
Packit 0b5880
  { "Signal Tests", "test_non_signal_8", CK_FAILURE, CK_MSG_TEXT, "Early exit with return value 0" },
Packit 0b5880
  { "Signal Tests", "test_fail_unless", CK_FAILURE, CK_MSG_TEXT, "Early exit with return value 1" },
Packit 0b5880
#if !defined(__CYGWIN__)
Packit 0b5880
  { "Signal Tests", "test_fpe", CK_ERROR, CK_MSG_TEXT,   signal_8_str },
Packit 0b5880
  { "Signal Tests", "test_mark_point", CK_ERROR, CK_MSG_TEXT,   signal_8_str },
Packit 0b5880
#endif /* !defined(__CYGWIN__) */
Packit 0b5880
#endif /* HAVE_FORK */
Packit 0b5880
Packit 0b5880
#if TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
#if HAVE_DECL_SETENV
Packit 0b5880
  { "Environment Integer Timeout Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Integer Timeout Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Tests", "test_sleep5_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "Environment Double Timeout Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Environment Double Timeout Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,  "Passed" },
Packit 0b5880
  { "Environment Double Timeout Tests", "test_sleep1_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Environment Double Timeout Tests", "test_sleep2_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Double Timeout Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Double Timeout Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_DECL_SETENV */
Packit 0b5880
Packit 0b5880
  { "Default Timeout Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Default Timeout Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Default Timeout Tests", "test_sleep1_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Default Timeout Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Default Timeout Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Default Timeout Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "User Integer Timeout Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Integer Timeout Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Tests", "test_sleep5_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
Packit 0b5880
  { "User Double Timeout Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "User Double Timeout Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Double Timeout Tests", "test_sleep1_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "User Double Timeout Tests", "test_sleep2_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Double Timeout Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Double Timeout Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
#if HAVE_DECL_SETENV
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep1_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep5_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep9_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Integer Timeout Scaling Tests", "test_sleep14_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep1_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep2_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Environment Double Timeout Scaling Tests", "test_sleep14_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_sleep1_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_sleep5_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Timeout Integer Scaling Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_sleep1_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_sleep2_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "Timeout Double Scaling Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep1_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep2_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep5_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep9_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Integer Timeout Scaling Tests", "test_sleep14_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_eternal_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#ifdef HAVE_LIBRT
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep0_025_pass", CK_PASS, CK_MSG_TEXT,   "Passed" },
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep1_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_LIBRT */
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep2_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep5_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep9_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
  { "User Double Timeout Scaling Tests", "test_sleep14_fail", CK_ERROR, CK_MSG_TEXT,  "Test timeout expired" },
Packit 0b5880
#endif /* HAVE_DECL_SETENV */
Packit 0b5880
#endif /* TIMEOUT_TESTS_ENABLED && defined(HAVE_FORK) */
Packit 0b5880
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
  { "Limit Tests", "test_early_exit", CK_ERROR, CK_MSG_TEXT,   "Early exit with return value 1" },
Packit 0b5880
#endif /* HAVE_FORK */
Packit 0b5880
#if MEMORY_LEAKING_TESTS_ENABLED
Packit 0b5880
  { "Limit Tests", "test_null", CK_FAILURE, CK_MSG_TEXT, "Completed properly" },
Packit 0b5880
#endif /* MEMORY_LEAKING_TESTS_ENABLED */
Packit 0b5880
  { "Limit Tests", "test_null_2", CK_FAILURE, CK_MSG_TEXT, "Completed properly" },
Packit 0b5880
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
  { "Msg and fork Tests", "test_fork1p_pass", CK_PASS, CK_MSG_TEXT,       "Passed" },
Packit 0b5880
  { "Msg and fork Tests", "test_fork1p_fail", CK_FAILURE, CK_MSG_TEXT,    "Expected fail" },
Packit 0b5880
  { "Msg and fork Tests", "test_fork1c_pass", CK_PASS, CK_MSG_TEXT,       "Passed" },
Packit 0b5880
  { "Msg and fork Tests", "test_fork1c_fail", CK_FAILURE, CK_MSG_TEXT,    "Expected fail" },
Packit 0b5880
  { "Msg and fork Tests", "test_fork2_pass", CK_PASS, CK_MSG_TEXT,       "Passed" },
Packit 0b5880
  { "Msg and fork Tests", "test_fork2_fail", CK_FAILURE, CK_MSG_TEXT,    "Expected fail" },
Packit 0b5880
#endif  /* HAVE_FORK */
Packit 0b5880
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
#if MEMORY_LEAKING_TESTS_ENABLED
Packit 0b5880
  { "Check Errors Tests", "test_invalid_set_fork_status", CK_FAILURE, CK_MSG_TEXT,    "Early exit with return value 2" },
Packit 0b5880
#endif
Packit 0b5880
  { "Check Ignore Exit Handlers", "test_ignore_exit_handlers", CK_FAILURE, CK_MSG_TEXT, "Failed" },
Packit 0b5880
#endif /* HAVE_FORK */
Packit 0b5880
Packit 0b5880
  { "Core", "test_srunner", CK_PASS, CK_MSG_TEXT,    "Passed" },
Packit 0b5880
  { "Core", "test_2nd_suite", CK_FAILURE, CK_MSG_TEXT, "We failed" }
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
static int nr_of_master_tests = sizeof master_tests /sizeof master_tests[0];
Packit 0b5880
Packit 0b5880
START_TEST(test_check_nfailures)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  int failed = 0;
Packit 0b5880
  
Packit 0b5880
  for (i = 0; i < nr_of_master_tests; i++) {
Packit 0b5880
    if (master_tests[i].failure_type != CK_PASS) {
Packit 0b5880
      failed++;
Packit 0b5880
    }
Packit 0b5880
  }
Packit 0b5880
  ck_assert_msg (sub_nfailed == failed,
Packit 0b5880
               "Unexpected number of failures received, %d, expected %d.",
Packit 0b5880
               sub_nfailed, failed);
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_ntests_run)
Packit 0b5880
{
Packit 0b5880
  ck_assert_msg (sub_ntests == nr_of_master_tests,
Packit 0b5880
               "Unexpected number of tests run %d vs expected %d", sub_ntests, nr_of_master_tests);
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Given a string, return a new string that is a copy
Packit 0b5880
 * of the original exception that every occurance of
Packit 0b5880
 * % is replaced with %%. This escapes the %
Packit 0b5880
 * symbol for passing to printf.
Packit 0b5880
 *
Packit 0b5880
 * The passed in string is not modified. Note though
Packit 0b5880
 * that the returned string is allocated memory that
Packit 0b5880
 * must be freed by the caller.
Packit 0b5880
 */
Packit 0b5880
char * escape_percent(const char *original, size_t original_size);
Packit 0b5880
char * escape_percent(const char *original, size_t original_size)
Packit 0b5880
{
Packit 0b5880
  /* In the worst case every character is a %*/
Packit 0b5880
  char *result = (char*)malloc(original_size*2);
Packit 0b5880
Packit 0b5880
  size_t read_index;
Packit 0b5880
  size_t write_index;
Packit 0b5880
  for(read_index = write_index = 0; read_index < original_size; read_index++, write_index++)
Packit 0b5880
  {
Packit 0b5880
    result[write_index] = original[read_index];
Packit 0b5880
    if(result[write_index] == '%')
Packit 0b5880
    {
Packit 0b5880
      /* Place a duplicate % next to the one just read, to escape it */
Packit 0b5880
      result[++write_index] = '%';
Packit 0b5880
    }
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  return result;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
START_TEST(test_check_failure_msgs)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  int passed = 0;
Packit 0b5880
  const char *got_msg;
Packit 0b5880
  const char *expected_msg;
Packit 0b5880
  unsigned char not_equal = 0;
Packit 0b5880
  char emsg[MAXSTR];
Packit 0b5880
  const char *msg_type_str;
Packit 0b5880
  char *emsg_escaped;
Packit 0b5880
  int reg_err;
Packit 0b5880
  char err_text[256];
Packit 0b5880
  TestResult *tr;
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  regex_t re;
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
  for (i = 0; i < sub_ntests; i++) {
Packit 0b5880
    master_test_t *master_test = &master_tests[i];
Packit 0b5880
Packit 0b5880
    if (master_test->failure_type == CK_PASS) {
Packit 0b5880
      passed++;
Packit 0b5880
      continue;
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    ck_assert_msg(i - passed <= sub_nfailed, NULL);
Packit 0b5880
    tr = tr_fail_array[i - passed];
Packit 0b5880
    ck_assert_msg(tr != NULL, NULL);
Packit 0b5880
    got_msg = tr_msg(tr);
Packit 0b5880
    expected_msg = master_test->msg;
Packit 0b5880
Packit 0b5880
    switch (master_test->msg_type) {
Packit 0b5880
    case CK_MSG_TEXT:
Packit 0b5880
      if (strcmp(got_msg, expected_msg) != 0) {
Packit 0b5880
        not_equal = 1;
Packit 0b5880
      }
Packit 0b5880
      break;
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
    case CK_MSG_REGEXP: {
Packit 0b5880
      reg_err = regcomp(&re, expected_msg, REG_EXTENDED | REG_NOSUB);
Packit 0b5880
      if (reg_err) {        
Packit 0b5880
        regerror(reg_err, &re, err_text, sizeof(err_text));
Packit 0b5880
        ck_assert_msg(reg_err == 0,
Packit 0b5880
                "For test %d:%s:%s Expected regexp '%s', but regcomp returned error '%s'",
Packit 0b5880
                i, master_test->tcname, master_test->test_name, expected_msg,
Packit 0b5880
                err_text);
Packit 0b5880
      }
Packit 0b5880
      reg_err = regexec(&re, got_msg, 0, NULL, 0);
Packit 0b5880
      regfree(&re);
Packit 0b5880
      if (reg_err) {
Packit 0b5880
        not_equal = 1;
Packit 0b5880
      }
Packit 0b5880
      break;
Packit 0b5880
    }
Packit 0b5880
#endif /* ENABLE_REGEX */
Packit 0b5880
    }
Packit 0b5880
    
Packit 0b5880
    if (not_equal) {      
Packit 0b5880
      switch(master_test->msg_type) {
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
      case CK_MSG_REGEXP:
Packit 0b5880
        msg_type_str = " regexp";
Packit 0b5880
        break;
Packit 0b5880
#endif
Packit 0b5880
      default:
Packit 0b5880
        msg_type_str = "";
Packit 0b5880
      }
Packit 0b5880
Packit 0b5880
      snprintf(emsg, MAXSTR - 1,"For test %d:%s:%s Expected%s '%s', got '%s'",
Packit 0b5880
               i, master_test->tcname, master_test->test_name, msg_type_str,
Packit 0b5880
               expected_msg, got_msg);
Packit 0b5880
      emsg[MAXSTR - 1] = '\0';
Packit 0b5880
Packit 0b5880
      /*
Packit 0b5880
       * NOTE: ck_abort_msg() will take the passed string
Packit 0b5880
       * and feed it to printf. We need to escape any
Packit 0b5880
       * '%' found, else they will result in odd formatting
Packit 0b5880
       * in ck_abort_msg().
Packit 0b5880
       */
Packit 0b5880
      emsg_escaped = escape_percent(emsg, MAXSTR);
Packit 0b5880
Packit 0b5880
      ck_abort_msg(emsg_escaped);
Packit 0b5880
      free(emsg_escaped);
Packit 0b5880
    }
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
  
Packit 0b5880
START_TEST(test_check_failure_lnos)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  int line_no;
Packit 0b5880
  int passed = 0;
Packit 0b5880
  int failed;
Packit 0b5880
  TestResult *tr;
Packit 0b5880
  
Packit 0b5880
  /* Create list of line numbers where failures occurred */
Packit 0b5880
  rewind(line_num_failures);
Packit 0b5880
Packit 0b5880
  for (i = 0; i < sub_ntests; i++) {
Packit 0b5880
    if (master_tests[i].failure_type == CK_PASS) {
Packit 0b5880
      passed++;
Packit 0b5880
      continue;
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    failed = i - passed;
Packit 0b5880
Packit 0b5880
    ck_assert_msg(i - passed <= sub_nfailed, NULL);
Packit 0b5880
    tr = tr_fail_array[failed];
Packit 0b5880
    ck_assert_msg(tr != NULL, NULL);
Packit 0b5880
    line_no = get_next_failure_line_num(line_num_failures);
Packit 0b5880
Packit 0b5880
    if(line_no == -1)
Packit 0b5880
    {
Packit 0b5880
      ck_abort_msg("Did not find the %dth failure line number for suite %s, msg %s",
Packit 0b5880
        (failed+1), tr_tcname(tr), tr_msg(tr));
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    if (line_no > 0 && tr_lno(tr) != line_no) {
Packit 0b5880
      ck_abort_msg("For test %d (failure %d): Expected lno %d, got %d for suite %s, msg %s",
Packit 0b5880
               i, failed, line_no, tr_lno(tr), tr_tcname(tr), tr_msg(tr));
Packit 0b5880
    }    
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  /* At this point, there should be no remaining failures */
Packit 0b5880
  line_no = get_next_failure_line_num(line_num_failures);
Packit 0b5880
  ck_assert_msg(line_no == -1,
Packit 0b5880
    "No more failure line numbers expected, but found %d", line_no);
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_failure_ftypes)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  int passed = 0;
Packit 0b5880
  TestResult *tr;
Packit 0b5880
  
Packit 0b5880
  for (i = 0; i < sub_ntests; i++) {
Packit 0b5880
    if (master_tests[i].failure_type == CK_PASS) {
Packit 0b5880
      passed++;
Packit 0b5880
      continue;
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    ck_assert_msg(i - passed <= sub_nfailed, NULL);
Packit 0b5880
    tr = tr_fail_array[i - passed];
Packit 0b5880
    ck_assert_msg(tr != NULL, NULL);
Packit 0b5880
    ck_assert_msg(master_tests[i].failure_type == tr_rtype(tr),
Packit 0b5880
                "Failure type wrong for test %d:%s:%s",
Packit 0b5880
				i, master_tests[i].tcname, master_tests[i].test_name);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_failure_lfiles)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  for (i = 0; i < sub_nfailed; i++) {
Packit 0b5880
    TestResult *tr = tr_fail_array[i];
Packit 0b5880
    ck_assert_msg(tr != NULL, NULL);
Packit 0b5880
    ck_assert_msg(tr_lfile(tr) != NULL, "Bad file name for test %d", i);
Packit 0b5880
    ck_assert_msg(strstr(tr_lfile(tr), "check_check_sub.c") != 0,
Packit 0b5880
                "Bad file name for test %d:%s:%s",
Packit 0b5880
				i, master_tests[i].tcname, master_tests[i].test_name);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_tcnames)
Packit 0b5880
{
Packit 0b5880
  const char *tcname;   
Packit 0b5880
  tcname = tr_tcname(tr_all_array[_i]);
Packit 0b5880
  if (strcmp(tcname, master_tests[_i].tcname) != 0) {
Packit 0b5880
    ck_abort_msg("Expected '%s', got '%s' for test %d:%s",
Packit 0b5880
         master_tests[_i].tcname, tcname,
Packit 0b5880
	     _i, master_tests[_i].test_name);
Packit 0b5880
  } 
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_test_names)
Packit 0b5880
{
Packit 0b5880
  int i;
Packit 0b5880
  int line_no;
Packit 0b5880
  int passed = 0;
Packit 0b5880
  int failed;
Packit 0b5880
  TestResult *tr;
Packit 0b5880
Packit 0b5880
  rewind(test_names_file);
Packit 0b5880
Packit 0b5880
  for (i = 0; i < sub_ntests; i++)
Packit 0b5880
  {
Packit 0b5880
	  char* test_name = get_next_test_name(test_names_file);
Packit 0b5880
Packit 0b5880
	  if(test_name == NULL || strcmp(master_tests[i].test_name, test_name) != 0)
Packit 0b5880
	  {
Packit 0b5880
		  ck_abort_msg("Expected test name '%s' but found '%s' for test %d:%s",
Packit 0b5880
				  master_tests[i].test_name,
Packit 0b5880
				  (test_name == NULL ? "(null)" : test_name),
Packit 0b5880
				  i, master_tests[i].tcname);
Packit 0b5880
	  }
Packit 0b5880
Packit 0b5880
	  free(test_name);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
START_TEST(test_check_all_msgs)
Packit 0b5880
{
Packit 0b5880
  const char *got_msg = tr_msg(tr_all_array[_i]);
Packit 0b5880
  master_test_t *master_test = &master_tests[_i];
Packit 0b5880
  const char *expected_msg = master_test->msg;
Packit 0b5880
  char emsg[MAXSTR];
Packit 0b5880
  const char *msg_type_str;
Packit 0b5880
  char err_text[256];
Packit 0b5880
  int reg_err;
Packit 0b5880
  unsigned char not_equal = 0;
Packit 0b5880
  char *emsg_escaped;
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  regex_t re;
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
  switch (master_test->msg_type) {
Packit 0b5880
  case CK_MSG_TEXT:
Packit 0b5880
    if (strcmp(got_msg, expected_msg) != 0) {
Packit 0b5880
      not_equal = 1;
Packit 0b5880
    }
Packit 0b5880
    break;
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
  case CK_MSG_REGEXP: {
Packit 0b5880
    reg_err = regcomp(&re, expected_msg, REG_EXTENDED | REG_NOSUB);
Packit 0b5880
    if (reg_err) {      
Packit 0b5880
      regerror(reg_err, &re, err_text, sizeof(err_text));
Packit 0b5880
      ck_assert_msg(reg_err == 0,
Packit 0b5880
                "For test %d:%s:%s Expected regexp '%s', but regcomp returned error '%s'",
Packit 0b5880
                _i, master_test->tcname, master_test->test_name, expected_msg,
Packit 0b5880
                err_text);
Packit 0b5880
    }
Packit 0b5880
    reg_err = regexec(&re, got_msg, 0, NULL, 0);
Packit 0b5880
    regfree(&re);
Packit 0b5880
    if (reg_err) {
Packit 0b5880
      not_equal = 1;
Packit 0b5880
    }
Packit 0b5880
    break;
Packit 0b5880
  }
Packit 0b5880
#endif /* ENABLE_REGEX */
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  if (not_equal) {    
Packit 0b5880
    switch(master_test->msg_type) {
Packit 0b5880
#if ENABLE_REGEX
Packit 0b5880
    case CK_MSG_REGEXP:
Packit 0b5880
      msg_type_str = " regexp";
Packit 0b5880
      break;
Packit 0b5880
#endif
Packit 0b5880
    default:
Packit 0b5880
      msg_type_str = "";
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    snprintf(emsg, MAXSTR - 1, "For test %i:%s:%s expected%s '%s', got '%s'",
Packit 0b5880
             _i, master_test->tcname, master_test->test_name, msg_type_str,
Packit 0b5880
             expected_msg, got_msg);
Packit 0b5880
    emsg[MAXSTR - 1] = '\0';
Packit 0b5880
Packit 0b5880
   /*
Packit 0b5880
    * NOTE: ck_abort_msg() will take the passed string
Packit 0b5880
    * and feed it to printf. We need to escape any
Packit 0b5880
    * '%' found, else they will result in odd formatting
Packit 0b5880
    * in ck_abort_msg().
Packit 0b5880
    */
Packit 0b5880
    emsg_escaped = escape_percent(emsg, MAXSTR);
Packit 0b5880
Packit 0b5880
    ck_abort_msg(emsg_escaped);
Packit 0b5880
    free(emsg_escaped);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
END_TEST  
Packit 0b5880
Packit 0b5880
START_TEST(test_check_all_ftypes)
Packit 0b5880
{
Packit 0b5880
  ck_assert_msg(master_tests[_i].failure_type == tr_rtype(tr_all_array[_i]),
Packit 0b5880
              "For test %d:%s:%s failure type wrong, expected %d but got %d",
Packit 0b5880
			  _i, master_tests[_i].tcname, master_tests[_i].test_name,
Packit 0b5880
			  master_tests[_i].failure_type, tr_rtype(tr_all_array[_i]));
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
int test_fixture_val = 0;
Packit 0b5880
static void test_fixture_setup(void)
Packit 0b5880
{
Packit 0b5880
  test_fixture_val = 1;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
START_TEST(test_setup)
Packit 0b5880
{
Packit 0b5880
  ck_assert_msg (test_fixture_val == 1,
Packit 0b5880
	       "Value not setup or changed across tests correctly");
Packit 0b5880
  test_fixture_val = 2;
Packit 0b5880
}
Packit 0b5880
END_TEST
Packit 0b5880
Packit 0b5880
static void test_fixture_teardown (void)
Packit 0b5880
{
Packit 0b5880
  test_fixture_val = 3;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
START_TEST(test_teardown)
Packit 0b5880
{
Packit 0b5880
  ck_assert_msg (test_fixture_val == 3,
Packit 0b5880
	       "Value not changed correctly in teardown");
Packit 0b5880
}
Packit 0b5880
END_TEST  
Packit 0b5880
Packit 0b5880
Packit 0b5880
Suite *make_master_suite (void)
Packit 0b5880
{
Packit 0b5880
  Suite *s;
Packit 0b5880
  TCase *tc_core;
Packit 0b5880
  TCase *tc_fixture;
Packit 0b5880
  TCase *tc_post_teardown;
Packit 0b5880
  
Packit 0b5880
  s = suite_create("Master");
Packit 0b5880
  tc_core = tcase_create("Core Tests");
Packit 0b5880
  tc_fixture = tcase_create("Fixture Setup Tests");
Packit 0b5880
  suite_add_tcase (s, tc_core);
Packit 0b5880
  tcase_add_test (tc_core, test_check_nfailures);
Packit 0b5880
  tcase_add_test (tc_core, test_check_ntests_run);
Packit 0b5880
  tcase_add_test (tc_core, test_check_failure_msgs);
Packit 0b5880
  tcase_add_test (tc_core, test_check_failure_ftypes);
Packit 0b5880
  tcase_add_test (tc_core, test_check_failure_lnos);
Packit 0b5880
  tcase_add_test (tc_core, test_check_failure_lfiles);
Packit 0b5880
  tcase_add_test (tc_core, test_check_test_names);
Packit 0b5880
  tcase_add_loop_test (tc_core, test_check_tcnames, 0, sub_ntests);
Packit 0b5880
  tcase_add_loop_test (tc_core, test_check_all_msgs, 0, sub_ntests);
Packit 0b5880
  tcase_add_loop_test (tc_core, test_check_all_ftypes, 0, nr_of_master_tests);
Packit 0b5880
  tcase_add_unchecked_fixture(tc_fixture, test_fixture_setup,
Packit 0b5880
			      test_fixture_teardown);
Packit 0b5880
  /* add the test 3 times to make sure we adequately test
Packit 0b5880
     preservation of fixture values across tests, regardless
Packit 0b5880
     of the order in which tests are added to the test case */
Packit 0b5880
  tcase_add_test (tc_fixture, test_setup);
Packit 0b5880
#if defined(HAVE_FORK) && HAVE_FORK==1
Packit 0b5880
  /* The remaining test runs only work if fork() is available. */
Packit 0b5880
  tcase_add_test (tc_fixture, test_setup);
Packit 0b5880
  tcase_add_test (tc_fixture, test_setup);
Packit 0b5880
#endif /* HAVE_FORK */
Packit 0b5880
  suite_add_tcase (s, tc_fixture);
Packit 0b5880
  tc_post_teardown = tcase_create ("Fixture Teardown Tests");
Packit 0b5880
  tcase_add_test (tc_post_teardown, test_teardown);
Packit 0b5880
  suite_add_tcase (s, tc_post_teardown);
Packit 0b5880
  return s;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
static void init_signal_strings(void)
Packit 0b5880
{
Packit 0b5880
  /* strsignal may overwrite the string returned by the previous call */
Packit 0b5880
  char *s8 = strdup(strsignal(8));
Packit 0b5880
  char *s11 = strdup(strsignal(11));
Packit 0b5880
  int n;
Packit 0b5880
  n = snprintf(signal_11_str, SIG_STR_LEN, "Received signal 11 (%s)", s11);
Packit 0b5880
  assert(n < SIG_STR_LEN);
Packit 0b5880
  n = snprintf(signal_11_8_str, SIG_STR_LEN, "Received signal 11 (%s), expected 8 (%s)", s11, s8);
Packit 0b5880
  assert(n < SIG_STR_LEN);
Packit 0b5880
  n = snprintf(signal_8_str, SIG_STR_LEN, "Received signal 8 (%s)", s8);
Packit 0b5880
  assert(n < SIG_STR_LEN);
Packit 0b5880
  free(s8);
Packit 0b5880
  free(s11);
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
void setup (void)
Packit 0b5880
{
Packit 0b5880
  Suite *s = make_sub_suite();
Packit 0b5880
  SRunner *sr = srunner_create(s);
Packit 0b5880
Packit 0b5880
  init_signal_strings();
Packit 0b5880
Packit 0b5880
  /*
Packit 0b5880
   * Create files that will contain the test names and line numbers of the failures
Packit 0b5880
   * in check_check_sub.c, as they occur.
Packit 0b5880
   */
Packit 0b5880
#if !HAVE_MKSTEMP
Packit 0b5880
  test_names_file_name = tempnam(NULL, "check_test_names_");
Packit 0b5880
  test_names_file = fopen(test_names_file_name, "w+b");
Packit 0b5880
  line_num_failures_file_name = tempnam(NULL, "check_error_linenums_");
Packit 0b5880
  line_num_failures = fopen(line_num_failures_file_name, "w+b");
Packit 0b5880
#else
Packit 0b5880
  test_names_file_name = strdup("check_test_names__XXXXXX");
Packit 0b5880
  test_names_file = fdopen(mkstemp(test_names_file_name), "w+b");
Packit 0b5880
  line_num_failures_file_name = strdup("check_error_linenums_XXXXXX");
Packit 0b5880
  line_num_failures = fdopen(mkstemp(line_num_failures_file_name), "w+b");
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
  srunner_add_suite(sr, make_sub2_suite());
Packit 0b5880
Packit 0b5880
  srunner_run_all(sr, CK_VERBOSE);
Packit 0b5880
  tr_fail_array = srunner_failures(sr);
Packit 0b5880
  tr_all_array = srunner_results(sr);
Packit 0b5880
  sub_nfailed = srunner_ntests_failed(sr);
Packit 0b5880
  sub_ntests = srunner_ntests_run(sr);
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
void cleanup (void)
Packit 0b5880
{
Packit 0b5880
  fclose(line_num_failures);
Packit 0b5880
  line_num_failures = NULL;
Packit 0b5880
  unlink(line_num_failures_file_name);
Packit 0b5880
  free(line_num_failures_file_name);
Packit 0b5880
  line_num_failures_file_name = NULL;
Packit 0b5880
Packit 0b5880
  fclose(test_names_file);
Packit 0b5880
  test_names_file = NULL;
Packit 0b5880
  unlink(test_names_file_name);
Packit 0b5880
  free(test_names_file_name);
Packit 0b5880
  test_names_file_name = NULL;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
void record_test_name(const char* test_name)
Packit 0b5880
{
Packit 0b5880
  int result;
Packit 0b5880
Packit 0b5880
  if(test_names_file == NULL)
Packit 0b5880
  {
Packit 0b5880
    /*
Packit 0b5880
     * The file may not be setup. This may be because some of the tests
Packit 0b5880
     * are being reused outside of the master suite. This is OK.
Packit 0b5880
     * If the master suite runs and does not find test names it will
Packit 0b5880
     * fail as expected.
Packit 0b5880
     */
Packit 0b5880
     fprintf(stderr, "Test name file not setup, not reporting test failure");
Packit 0b5880
     return;
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  fprintf(test_names_file, "%s\n", test_name);
Packit 0b5880
Packit 0b5880
  result = fflush(test_names_file);
Packit 0b5880
  if(result != 0)
Packit 0b5880
  {
Packit 0b5880
    fprintf(stderr, "%s:%d: Error in call to fflush", __FILE__, __LINE__);
Packit 0b5880
    exit(1);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
char* get_next_test_name(FILE * file)
Packit 0b5880
{
Packit 0b5880
  char * line = NULL;
Packit 0b5880
  size_t length;
Packit 0b5880
  ssize_t written;
Packit 0b5880
Packit 0b5880
  written = getline(&line, &length, file);
Packit 0b5880
  /**
Packit 0b5880
   * getline() will leave a \n at the end of the line,
Packit 0b5880
   * remove it if it is present.
Packit 0b5880
   */
Packit 0b5880
  if(written > 0 && line[written-1] == '\n')
Packit 0b5880
  {
Packit 0b5880
	  line[written-1] = '\0';
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  return line;
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
void record_failure_line_num(int linenum)
Packit 0b5880
{
Packit 0b5880
  int to_write;
Packit 0b5880
  ssize_t written;
Packit 0b5880
  int result;
Packit 0b5880
  char string[16];
Packit 0b5880
Packit 0b5880
  /*
Packit 0b5880
   * Because this call will occur right before a failure,
Packit 0b5880
   * add +1 so the linenum will be that of the failure
Packit 0b5880
   */
Packit 0b5880
   linenum += 1;
Packit 0b5880
Packit 0b5880
  to_write = snprintf(string, sizeof(string), "%d\n", linenum);
Packit 0b5880
  if(to_write <= 0)
Packit 0b5880
  {
Packit 0b5880
    fprintf(stderr, "%s:%d: Error in call to snprintf:", __FILE__, __LINE__);
Packit 0b5880
    exit(1);
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  if(line_num_failures == NULL)
Packit 0b5880
  {
Packit 0b5880
    /*
Packit 0b5880
     * The file may not be setup. This may be because some of the tests
Packit 0b5880
     * are being reused outside of the master suite. This is OK.
Packit 0b5880
     * If the master suite runs and does not find line numbers it will
Packit 0b5880
     * fail as expected.
Packit 0b5880
     */
Packit 0b5880
     fprintf(stderr, "Line number file not setup, not reporting test failure     line: %s", string);
Packit 0b5880
     return;
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  written = fwrite(string, 1, to_write, line_num_failures);
Packit 0b5880
  if(written != to_write)
Packit 0b5880
  {
Packit 0b5880
    fprintf(stderr, "%s:%d: Error in call to fwrite, wrote %ld instead of %d:", __FILE__, __LINE__, written, to_write);
Packit 0b5880
    exit(1);
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  result = fflush(line_num_failures);
Packit 0b5880
  if(result != 0)
Packit 0b5880
  {
Packit 0b5880
    fprintf(stderr, "%s:%d: Error in call to fflush", __FILE__, __LINE__);
Packit 0b5880
    exit(1);
Packit 0b5880
  }
Packit 0b5880
}
Packit 0b5880
Packit 0b5880
int get_next_failure_line_num(FILE * file)
Packit 0b5880
{
Packit 0b5880
  char * line = NULL;
Packit 0b5880
  char * end = NULL;
Packit 0b5880
  size_t length;
Packit 0b5880
  ssize_t written;
Packit 0b5880
  int value = -1;
Packit 0b5880
Packit 0b5880
  written = getline(&line, &length, file);
Packit 0b5880
Packit 0b5880
  if(written > 0)
Packit 0b5880
  {
Packit 0b5880
    /*
Packit 0b5880
     * getline() will leave the \n at the end of the parsed line, if
Packit 0b5880
     * it is found. Remove this before passing to strtol, so we
Packit 0b5880
     * may detect invalid characters by checking for \0 instead
Packit 0b5880
     */
Packit 0b5880
Packit 0b5880
    if(line[written-1] == '\n')
Packit 0b5880
    {
Packit 0b5880
      line[written-1] = '\0';
Packit 0b5880
    }
Packit 0b5880
Packit 0b5880
    value = strtol(line, &end, 10);
Packit 0b5880
Packit 0b5880
    if(value <= 0 || *end != '\0')
Packit 0b5880
    {
Packit 0b5880
      fprintf(stderr, "%s:%d: Failed to convert next failure line number, found '%s'\n",
Packit 0b5880
        __FILE__, __LINE__, line);
Packit 0b5880
      exit(1);
Packit 0b5880
    }
Packit 0b5880
  }
Packit 0b5880
Packit 0b5880
  free(line);
Packit 0b5880
Packit 0b5880
  return value;
Packit 0b5880
}