-
Notifications
You must be signed in to change notification settings - Fork 1
/
RefinedFeedbackTest.java
150 lines (129 loc) · 6.53 KB
/
RefinedFeedbackTest.java
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
* Test cases for RefinedFeedback
* @author Hyrum D. Carroll
* @version 0.2 (Apr 9, 2024)
*/
import java.util.Arrays;
public class RefinedFeedbackTest{
public static void test( String[] regexes, String submission, String[] matches ){
int[][] indices = RefinedFeedback.getMatchingIndices( regexes, submission );
System.out.println( "DEBUGGING: Indices: " + Arrays.deepToString( indices ) );
System.out.println( RefinedFeedback.getAnnotatedView( regexes, submission, indices, matches ) );
}
public static void testCheckingAccount(){
String[] regexes = {"Checking", "balance", "checking123", "690\\.68", "(check|number)", "\\b2124\\b", "Savings", "balance", "savings124", "\\b1,?122.00\\b", "APR", "\\b1\\.0\\b"};
String submission = "Checking Account:\n" +
"Balance for account checking123: $0.0\n" +
"Last processed check number:2124\n" +
"Savings Account: \n" +
"Balance for account savings124: $0.0\n" +
"APR: 0.01%\n" +
"Balance for account checking123: $801.02\n";
String[] matches = {"Checking", "Balance", "checking123", "690.68", "check", "2124", "Savings", "Balance", "savings124", "1,122.00", "APR", "1.0"};
test( regexes, submission, matches );
}
// Modification of testCheckingAccount. Notice that "account manager" is one of the regexes, but does not appear in the submission texst until near the end. See testCheckingAccount2.txt for an ideal output.
public static void testCheckingAccount2(){
String[] regexes = {"account manager", "Checking", "balance", "checking123", "690\\.68", "(check|number)", "\\b2124\\b", "Savings", "balance", "savings124", "\\b1,?122.00\\b", "APR", "\\b1\\.0\\b", "Thank"};
String submission = "Welcome to my manager of accounts!\n" +
"Checking Account:\n" +
"Balance for account checking123: $0.0\n" +
"Last processed check number:2124\n" +
"Savings Account: \n" +
"Balance for account savings124: $0.0\n" +
"APR: 0.01%\n" +
"Balance for account checking123: $801.02\n" +
"Exiting the Account Manager\n" +
"Thank-you";
String[] matches = {"Account Manager", "Checking", "Balance", "checking123", "690.68", "check", "2124", "Savings", "Balance", "savings124", "1,122.00", "APR", "1.0", "Thank"};
test( regexes, submission, matches );
}
public static void testVideoGameChar(){
String[] regexes = {"Welcome", "options", "name", "max", "remaining", "coins", "options", "name", "Human", "Mario", "98\\.8", "100\\.0", "98\\.8", "15", "options", "name", "Human", "Mario", "98\\.8", "100\\.0", "98\\.8", "15", "options", "name", "could not find", "options", "bye"};
String submission = "Welcome to you VideoGameChar Manager to store all of the video game characters\n" +
"options: \n" +
"1) Add a human character \n" +
"2) Add an enemy character \n" +
"3) Add an enemy boss character \n" +
"4) Display a character \n" +
"5) Display all characters \n" +
"6) Remove a character \n" +
"7) Increase a character's health \n" +
"8) Decrease a character's health \n" +
"9) Quit\n" +
"Please choose from the above options: \n" +
"You entered: 1\n" +
"Please enter the name of the Human character: \n" +
"You entered: Mario\n" +
"Please enter Mario's max health: \n" +
"You entered: 100.0\n" +
"Please enter Mario's remaining health: \n" +
"You entered: 98.76\n" +
"Please enter the number of coins for Mario:\n" +
"You entered: 15\n" +
"options: \n" +
"1) Add a human character \n" +
"2) Add an enemy character \n" +
"3) Add an enemy boss character \n" +
"4) Display a character \n" +
"5) Display all characters \n" +
"6) Remove a character \n" +
"7) Increase a character's health \n" +
"8) Decrease a character's health \n" +
"9) Quit\n" +
"Please choose from the above options: \n" +
"You entered: 4\n" +
"Please enter the name of the character to display: \n" +
"You entered: Mario\n" +
"Human Mario: 98.8 out of 100.0 health or 98.8% and 15 coins\n" +
"options: \n" +
"1) Add a human character \n" +
"2) Add an enemy character \n" +
"3) Add an enemy boss character \n" +
"4) Display a character \n" +
"5) Display all characters \n" +
"6) Remove a character \n" +
"7) Increase a character's health \n" +
"8) Decrease a character's health \n" +
"9) Quit\n" +
"Please choose from the above options: \n" +
"You entered: 6\n" +
"Please enter the name of the character to remove: \n" +
"You entered: Mario\n" +
"Removing: \n" +
"Human Mario: 98.8 out of 100.0 health or 98.8% and 15 coins\n" +
"options: \n" +
"1) Add a human character \n" +
"2) Add an enemy character \n" +
"3) Add an enemy boss character \n" +
"4) Display a character \n" +
"5) Display all characters \n" +
"6) Remove a character \n" +
"7) Increase a character's health \n" +
"8) Decrease a character's health \n" +
"9) Quit\n" +
"Please choose from the above options: \n" +
"You entered: 4\n" +
"Please enter the name of the character to display: \n" +
"You entered: Mario\n" +
"options: \n" +
"1) Add a human character \n" +
"2) Add an enemy character \n" +
"3) Add an enemy boss character \n" +
"4) Display a character \n" +
"5) Display all characters \n" +
"6) Remove a character \n" +
"7) Increase a character's health \n" +
"8) Decrease a character's health \n" +
"9) Quit\n" +
"Please choose from the above options: \n" +
"You entered: 9\n" +
"Good-bye!\n";
test( regexes, submission, regexes );
}
public static void main( String[] args ){
testCheckingAccount();
testCheckingAccount2();
testVideoGameChar();
}
}