summaryrefslogtreecommitdiff
path: root/Homework/cs5300/project-two/scanner/Tests.java
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
commit6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch)
treeed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5300/project-two/scanner/Tests.java
downloadmisc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.tar.gz
misc-undergrad-6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6.zip
Diffstat (limited to 'Homework/cs5300/project-two/scanner/Tests.java')
-rw-r--r--Homework/cs5300/project-two/scanner/Tests.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/Homework/cs5300/project-two/scanner/Tests.java b/Homework/cs5300/project-two/scanner/Tests.java
new file mode 100644
index 0000000..19413fa
--- /dev/null
+++ b/Homework/cs5300/project-two/scanner/Tests.java
@@ -0,0 +1,50 @@
+/*
+ * 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(Exception e) {
+ N++;
+ failures++;
+ System.err.println("Failed test " + N + ": " + e);
+ }
+
+ public int getN() {
+ return N;
+ }
+
+ public int getSuccesses() {
+ return N - failures;
+ }
+
+ public int getFailures() {
+ return failures;
+ }
+}