Lines Matching +full:t +full:- +full:head

26 #include "atf-c/macros.h"
40 #include <atf-c.h>
42 #include "atf-c/detail/fs.h"
43 #include "atf-c/detail/process.h"
44 #include "atf-c/detail/test_helpers.h"
45 #include "atf-c/detail/text.h"
47 /* ---------------------------------------------------------------------
49 * --------------------------------------------------------------------- */
59 O_CREAT | O_WRONLY | O_TRUNC, 0644) != -1); in create_ctl_file()
79 init_and_run_h_tc(const char *name, void (*head)(atf_tc_t *), in init_and_run_h_tc()
85 RE(atf_tc_init(&tc, name, head, body, NULL, config)); in init_and_run_h_tc()
90 /* ---------------------------------------------------------------------
92 * --------------------------------------------------------------------- */
208 /* ---------------------------------------------------------------------
210 * --------------------------------------------------------------------- */
216 return -1; in errno_fail_stub()
225 H_CHECK_ERRNO(no_error, -1, errno_ok_stub() == -1);
226 H_CHECK_ERRNO(errno_ok, 2, errno_fail_stub(2) == -1);
227 H_CHECK_ERRNO(errno_fail, 3, errno_fail_stub(4) == -1);
229 H_REQUIRE_ERRNO(no_error, -1, errno_ok_stub() == -1);
230 H_REQUIRE_ERRNO(errno_ok, 2, errno_fail_stub(2) == -1);
231 H_REQUIRE_ERRNO(errno_fail, 3, errno_fail_stub(4) == -1);
241 void (*head)(atf_tc_t *); in ATF_TC_BODY() member
245 } *t, tests[] = { in ATF_TC_BODY() local
248 false, "Expected true value in errno_ok_stub\\(\\) == -1" }, in ATF_TC_BODY()
254 false, "Expected errno 3, got 4, in errno_fail_stub\\(4\\) == -1" }, in ATF_TC_BODY()
258 for (t = &tests[0]; t->head != NULL; t++) { in ATF_TC_BODY()
259 init_and_run_h_tc("h_check_errno", t->head, t->body); in ATF_TC_BODY()
264 if (t->ok) { in ATF_TC_BODY()
269 "macros_test.c:[0-9]+: %s$", "error", t->exp_regex)); in ATF_TC_BODY()
272 ATF_REQUIRE(unlink("before") != -1); in ATF_TC_BODY()
273 ATF_REQUIRE(unlink("after") != -1); in ATF_TC_BODY()
285 void (*head)(atf_tc_t *); in ATF_TC_BODY() member
289 } *t, tests[] = { in ATF_TC_BODY() local
292 false, "Expected true value in errno_ok_stub\\(\\) == -1" }, in ATF_TC_BODY()
298 false, "Expected errno 3, got 4, in errno_fail_stub\\(4\\) == -1" }, in ATF_TC_BODY()
302 for (t = &tests[0]; t->head != NULL; t++) { in ATF_TC_BODY()
303 init_and_run_h_tc("h_require_errno", t->head, t->body); in ATF_TC_BODY()
306 if (t->ok) { in ATF_TC_BODY()
311 "^failed: .*macros_test.c:[0-9]+: %s$", "result", in ATF_TC_BODY()
312 t->exp_regex)); in ATF_TC_BODY()
316 ATF_REQUIRE(unlink("before") != -1); in ATF_TC_BODY()
317 if (t->ok) in ATF_TC_BODY()
318 ATF_REQUIRE(unlink("after") != -1); in ATF_TC_BODY()
322 /* ---------------------------------------------------------------------
324 * --------------------------------------------------------------------- */
340 void (*head)(atf_tc_t *); in ATF_TC_BODY() member
345 } *t, tests[] = { in ATF_TC_BODY() local
357 for (t = &tests[0]; t->head != NULL; t++) { in ATF_TC_BODY()
358 printf("Checking with a %d value\n", t->value); in ATF_TC_BODY()
360 init_and_run_h_tc("h_check", t->head, t->body); in ATF_TC_BODY()
365 if (t->ok) { in ATF_TC_BODY()
370 "macros_test.c:[0-9]+: %s$", "error", t->msg)); in ATF_TC_BODY()
373 ATF_REQUIRE(unlink("before") != -1); in ATF_TC_BODY()
374 ATF_REQUIRE(unlink("after") != -1); in ATF_TC_BODY()
378 /* ---------------------------------------------------------------------
380 * --------------------------------------------------------------------- */
383 void (*head)(atf_tc_t *); member
395 const struct check_eq_test *t; in do_check_eq_tests() local
397 for (t = &tests[0]; t->head != NULL; t++) { in do_check_eq_tests()
398 printf("Checking with %s, %s and expecting %s\n", t->v1, t->v2, in do_check_eq_tests()
399 t->ok ? "true" : "false"); in do_check_eq_tests()
401 init_and_run_h_tc("h_check", t->head, t->body); in do_check_eq_tests()
406 if (t->ok) { in do_check_eq_tests()
411 "macros_test.c:[0-9]+: %s$", "error", t->msg)); in do_check_eq_tests()
414 ATF_CHECK(unlink("before") != -1); in do_check_eq_tests()
415 ATF_CHECK(unlink("after") != -1); in do_check_eq_tests()
510 /* ---------------------------------------------------------------------
512 * --------------------------------------------------------------------- */
514 H_CHECK_MATCH(yes, "hello [a-z]+", "abc hello world");
515 H_CHECK_MATCH(no, "hello [a-z]+", "abc hello WORLD");
516 H_CHECK_MATCH_MSG(yes, "hello [a-z]+", "abc hello world", "lowercase");
517 H_CHECK_MATCH_MSG(no, "hello [a-z]+", "abc hello WORLD", "uppercase");
529 "hello [a-z]+", "abc hello world", "", true }, in ATF_TC_BODY()
531 "hello [a-z]+", "abc hello WORLD", in ATF_TC_BODY()
532 "'hello \\[a-z\\]\\+' not matched in 'abc hello WORLD'", false }, in ATF_TC_BODY()
534 "hello [a-z]+", "abc hello world", "", true }, in ATF_TC_BODY()
536 "hello [a-z]+", "abc hello WORLD", in ATF_TC_BODY()
537 "'hello \\[a-z\\]\\+' not matched in 'abc hello WORLD': uppercase", in ATF_TC_BODY()
544 /* ---------------------------------------------------------------------
546 * --------------------------------------------------------------------- */
562 void (*head)(atf_tc_t *); in ATF_TC_BODY() member
567 } *t, tests[] = { in ATF_TC_BODY() local
579 for (t = &tests[0]; t->head != NULL; t++) { in ATF_TC_BODY()
580 printf("Checking with a %d value\n", t->value); in ATF_TC_BODY()
582 init_and_run_h_tc("h_require", t->head, t->body); in ATF_TC_BODY()
585 if (t->ok) { in ATF_TC_BODY()
590 "^failed: .*macros_test.c:[0-9]+: %s$", "result", t->msg)); in ATF_TC_BODY()
594 ATF_REQUIRE(unlink("before") != -1); in ATF_TC_BODY()
595 if (t->ok) in ATF_TC_BODY()
596 ATF_REQUIRE(unlink("after") != -1); in ATF_TC_BODY()
600 /* ---------------------------------------------------------------------
602 * --------------------------------------------------------------------- */
605 void (*head)(atf_tc_t *); member
617 const struct require_eq_test *t; in do_require_eq_tests() local
619 for (t = &tests[0]; t->head != NULL; t++) { in do_require_eq_tests()
620 printf("Checking with %s, %s and expecting %s\n", t->v1, t->v2, in do_require_eq_tests()
621 t->ok ? "true" : "false"); in do_require_eq_tests()
623 init_and_run_h_tc("h_require", t->head, t->body); in do_require_eq_tests()
626 if (t->ok) { in do_require_eq_tests()
631 ":[0-9]+: %s$", "result", t->msg)); in do_require_eq_tests()
635 ATF_REQUIRE(unlink("before") != -1); in do_require_eq_tests()
636 if (t->ok) in do_require_eq_tests()
637 ATF_REQUIRE(unlink("after") != -1); in do_require_eq_tests()
732 /* ---------------------------------------------------------------------
734 * --------------------------------------------------------------------- */
736 H_REQUIRE_MATCH(yes, "hello [a-z]+", "abc hello world");
737 H_REQUIRE_MATCH(no, "hello [a-z]+", "abc hello WORLD");
738 H_REQUIRE_MATCH_MSG(yes, "hello [a-z]+", "abc hello world", "lowercase");
739 H_REQUIRE_MATCH_MSG(no, "hello [a-z]+", "abc hello WORLD", "uppercase");
751 "hello [a-z]+", "abc hello world", "", true }, in ATF_TC_BODY()
753 "hello [a-z]+", "abc hello WORLD", in ATF_TC_BODY()
754 "'hello \\[a-z\\]\\+' not matched in 'abc hello WORLD'", false }, in ATF_TC_BODY()
757 "hello [a-z]+", "abc hello world", "", true }, in ATF_TC_BODY()
759 "hello [a-z]+", "abc hello WORLD", in ATF_TC_BODY()
760 "'hello \\[a-z\\]\\+' not matched in 'abc hello WORLD': uppercase", in ATF_TC_BODY()
767 /* ---------------------------------------------------------------------
769 * --------------------------------------------------------------------- */
794 "as part of the automatically-generated messages " in ATF_TC_HEAD()
800 void (*head)(atf_tc_t *); in ATF_TC_BODY() member
804 } *t, tests[] = { in ATF_TC_BODY() local
816 for (t = &tests[0]; t->head != NULL; t++) { in ATF_TC_BODY()
817 printf("Checking with an expected '%s' message\n", t->msg); in ATF_TC_BODY()
819 init_and_run_h_tc("h_check", t->head, t->body); in ATF_TC_BODY()
821 if (t->fatal) { in ATF_TC_BODY()
824 "^failed: .*macros_test.c:[0-9]+: %s$", "result", t->msg); in ATF_TC_BODY()
825 ATF_CHECK_MSG(matched, "couldn't find error string in result"); in ATF_TC_BODY()
828 "macros_test.c:[0-9]+: %s$", "error", t->msg); in ATF_TC_BODY()
829 ATF_CHECK_MSG(matched, "couldn't find error string in output"); in ATF_TC_BODY()
834 /* ---------------------------------------------------------------------
836 * --------------------------------------------------------------------- */
839 "Tests that the macros provided by the atf-c/macros.h file "
841 "Build of macros_h_test.c failed; some macros in atf-c/macros.h "
868 /* ---------------------------------------------------------------------
870 * --------------------------------------------------------------------- */