diff options
Diffstat (limited to 'Homework/cs5300/project-one/p1-scanner/scanner/Tests.java')
| -rw-r--r-- | Homework/cs5300/project-one/p1-scanner/scanner/Tests.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Homework/cs5300/project-one/p1-scanner/scanner/Tests.java b/Homework/cs5300/project-one/p1-scanner/scanner/Tests.java new file mode 100644 index 0000000..bb51147 --- /dev/null +++ b/Homework/cs5300/project-one/p1-scanner/scanner/Tests.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package scanner; + +/** + * A test utility class. + * + * Do not modify this file. + */ +public class Tests { + + private int N = 0; + private int failures = 0; + + public void test(boolean b) { + N++; + if (!b) { + System.err.println("Failed test " + N); + failures++; + } + } + + public void test(boolean b, String message) { + test(b); + if (!b) { + System.err.println(message); + } + } + + public void addFailure() { + N++; + failures++; + } + + public int getN() { + return N; + } + + public int getSuccesses() { + return N - failures; + } + + public int getFailures() { + return failures; + } +} |
