From 6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 2 Jul 2026 11:55:17 -0700 Subject: Init --- .../project-one/p1-scanner/scanner/Tests.java | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Homework/cs5300/project-one/p1-scanner/scanner/Tests.java (limited to 'Homework/cs5300/project-one/p1-scanner/scanner/Tests.java') 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; + } +} -- cgit v1.3