|
|
1.1 ! root 1: /* The Plum Hall Validation Suite for C ! 2: * Unpublished copyright (c) 1986-1991, Chiron Systems Inc and Plum Hall Inc. ! 3: * VERSION: 4 ! 4: * DATE: 1993-01-01 ! 5: * The "ANSI" mode of this suite corresponds to official ANSI C, X3.159-1989. ! 6: * As per your license agreement, your distribution is not to be moved or copied outside the Designated Site ! 7: * without specific permission from Plum Hall Inc. ! 8: */ ! 9: ! 10: ! 11: #include "flags.h" ! 12: #ifndef SKIP42 ! 13: #define LIB_TEST 1 ! 14: /* ! 15: * 4.2 - Diagnostics <assert.h> ! 16: */ ! 17: #include "defs.h" ! 18: #include <assert.h> ! 19: #if !ANSI ! 20: #include <stdio.h> ! 21: #endif ! 22: void d4_2(); ! 23: static void d4_2_1(); ! 24: #if ANSI ! 25: void d4_2_1b(); ! 26: #endif ! 27: ! 28: /* NDEBUG is not defined by <assert.h>. Force an error if it is */ ! 29: #if defined(NDEBUG) ! 30: complain(__LINE__); ! 31: #endif ! 32: ! 33: void d4_2() ! 34: { ! 35: d4_2_1(); ! 36: } ! 37: ! 38: ! 39: ! 40: ! 41: ! 42: ! 43: ! 44: ! 45: ! 46: ! 47: ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: /* ! 54: * 4.2.1 - Program Diagnostics ! 55: * Since assert() must abort when the argument is FALSE, we can't ! 56: * test that here. We can, however, test that NDEBUG disables it. ! 57: */ ! 58: static void d4_2_1() ! 59: { ! 60: int i = ivalue(1); ! 61: int j = ivalue(0); ! 62: ! 63: /* 4.2.1.1 assert */ ! 64: #if ANSI8712 ! 65: /* assert is an expression */ ! 66: assert(i == 1), assert(j == 0); ! 67: #else ! 68: assert(i == 1); ! 69: #endif ! 70: #if ANSI ! 71: d4_2_1b(); ! 72: #endif ! 73: } ! 74: ! 75: #else /* if SKIP42 */ ! 76: void d4_2() { pr_skip("d4_2: SKIPPED ENTIRELY\n"); } ! 77: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.