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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// TEST FILE

#include <stdio.h>
#include <stdlib.h>
#include "print_integer.h"

int main(int argc, const char* argv[]) {
    // Test 0:  empty test
    
    // Test 1:  zero in base 10
    print_integer(0, 10, "");
    fputc('\n', stdout);

    // Test 2: two in base 10
    print_integer(2, 10, "");

    fputc('\n', stdout);  // '\n' is a newline character.  This will make the output 
                          // of this program match expected.txt.
    return EXIT_SUCCESS;
}


/*
To open all files in tabs as one command:
$ vim -p test_print_integer.c print_integer.c print_integer.h

  Don't type the leading $.  It is just a reminder that this is something you type in bash.

$ vim -p *.?
  
  *.? means a file that consists of 0 or more characters (*), a period (.), and one more
  character (?).  This includes print_integer.c test_print_integer.c print_integer.h, but does
  not include test_print_integer (the executable) or something like readme.txt (ends in 3
  characters).

Angle brackets are for system header files that come with Linux or your compiler.
#include <stdlib.h>

Double quotes are for header files that you provide.
#include "print_integer.h"

:w saves only the current file.
:wall saves all open file.
:x is the same as :w and then :q
:xall is the same as :wall and then :q

OPTIONAL
$ ./test_print_integer > actual.txt; diff actual.txt expected.txt

$ diff <(./test_print_integer) expected.txt

To see man file for fputc (or other standard library functions, put cursor
over the function name in normal mode and then press K (capital letter).

To exit the man file, press q.
*/

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