⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex_output.c

📁 c unit test framework
💻 C
字号:
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <check.h>START_TEST(test_pass){  fail_unless (1==1, "Shouldn't see this");}END_TESTSTART_TEST(test_fail){  fail("Failure");}END_TESTSTART_TEST(test_exit){  exit(1);}END_TESTstatic Suite *make_suite (void){  Suite *s;  TCase *tc;  s = suite_create("Master");  tc = tcase_create ("Core");  suite_add_tcase(s, tc);  tcase_add_test (tc, test_pass);  tcase_add_test (tc, test_fail);  tcase_add_test (tc, test_exit);  return s;}static void run_tests (int printmode){  SRunner *sr;  Suite *s;  s = make_suite();  sr = srunner_create(s);  srunner_run_all(sr, printmode);  srunner_free(sr);}int main (int argc, char **argv){    if (argc != 2) {    printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n");    return EXIT_FAILURE;  }  if (strcmp (argv[1], "CK_SILENT") == 0)    run_tests(CK_SILENT);  else if (strcmp (argv[1], "CK_MINIMAL") == 0)    run_tests(CK_MINIMAL);  else if (strcmp (argv[1], "CK_NORMAL") == 0)    run_tests(CK_NORMAL);  else if (strcmp (argv[1], "CK_VERBOSE") == 0)    run_tests(CK_VERBOSE);  else {    printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n");    return EXIT_FAILURE;  }          return EXIT_SUCCESS;}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -