1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// This is what HW04 would look like if it were based on HW02 instead of HW05.
#include "print_integer.h"  // remember:  For HW04, you would have "mintf.h"

int main(int argc, char* argv[]) {
    // TEST 00:  Empty test
    // (nothing)
    // Expect: no output
    //
    // ⚠ PITFALL:  Forget empty test.
    
    // TEST 01: one particular digit in base 10
    print_integer(0, 10, "");
    // EXPECT: 0
    
    // TEST 02: any non-negative single-digit number in base 10
    print_integer(5, 10, "");
    // EXPECT: 5
    
    // TEST 02: any non-negative single-digit number in base 10
    print_integer(6, 10, "");
    // EXPECT: 6
    //
    // BAD!!!!  This is wrong because I do not believe there any REASONABLE way to implement
    // print_integer(…) such that it works with 0 and 5, but not 6.
    //
    // This test case violates conditions c, d, e in the HW04 specification.
    //
    // ⚠ PITFALL:  Tests are not truly incremental.

    // …
    return EXIT_SUCCESS;
}

© Copyright 2021 Alexander J. Quinn         This content is protected and may not be shared, uploaded, or distributed.