Skip to content

Commit 8e42202

Browse files
add test cases
1 parent 873af1f commit 8e42202

File tree

2 files changed

+254
-0
lines changed

2 files changed

+254
-0
lines changed

code/tests/cases/test_soap.c

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,100 @@ FOSSIL_TEST_CASE(c_test_soap_count_rotbrain_with_punctuation) {
151151
ASSUME_ITS_EQUAL_I32(2, fossil_soap_count_rotbrain(input));
152152
}
153153

154+
FOSSIL_TEST_CASE(c_test_soap_context_aware_offensive) {
155+
char input[] = "This is a test with curse1 and racist_phrase1.";
156+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
157+
}
158+
159+
FOSSIL_TEST_CASE(c_test_soap_context_aware_rotbrain) {
160+
char input[] = "This is a test with lol and brb.";
161+
ASSUME_ITS_EQUAL_I32(2, fossil_soap_context_aware(input));
162+
}
163+
164+
FOSSIL_TEST_CASE(c_test_soap_context_aware_clean) {
165+
char input[] = "This is a clean sentence.";
166+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
167+
}
168+
169+
FOSSIL_TEST_CASE(c_test_soap_context_aware_mixed) {
170+
char input[] = "This is a test with curse1 and lol.";
171+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
172+
}
173+
174+
FOSSIL_TEST_CASE(c_test_soap_context_aware_case_insensitive) {
175+
char input[] = "This is a test with CuRsE1 and LoL.";
176+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
177+
}
178+
179+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_punctuation) {
180+
char input[] = "This is a test with curse1, and lol!";
181+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
182+
}
183+
184+
FOSSIL_TEST_CASE(c_test_soap_context_aware_no_offensive_or_rotbrain) {
185+
char input[] = "This is a test with no offensive or rotbrain words.";
186+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
187+
}
188+
189+
FOSSIL_TEST_CASE(c_test_soap_context_aware_only_rotbrain) {
190+
char input[] = "This is a test with lol and brb.";
191+
ASSUME_ITS_EQUAL_I32(2, fossil_soap_context_aware(input));
192+
}
193+
194+
FOSSIL_TEST_CASE(c_test_soap_context_aware_only_offensive) {
195+
char input[] = "This is a test with curse1 and racist_phrase1.";
196+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
197+
}
198+
199+
FOSSIL_TEST_CASE(c_test_soap_context_aware_mixed_case) {
200+
char input[] = "This is a test with CuRsE1 and LoL.";
201+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
202+
}
203+
204+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_special_characters) {
205+
char input[] = "This is a test with curse1@ and lol#.";
206+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
207+
}
208+
209+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_numbers) {
210+
char input[] = "This is a test with curse1 and lol123.";
211+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
212+
}
213+
214+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_mixed_content) {
215+
char input[] = "This is a test with curse1, lol, and clean words.";
216+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
217+
}
218+
219+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_spaces) {
220+
char input[] = "This is a test with curse1 and lol .";
221+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
222+
}
223+
224+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_tabs) {
225+
char input[] = "This is a test with\tcurse1\tand\tlol\t.";
226+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
227+
}
228+
229+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_newlines) {
230+
char input[] = "This is a test with\ncurse1\nand\nlol\n.";
231+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
232+
}
233+
234+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_mixed_whitespace) {
235+
char input[] = "This is a test with \t\ncurse1 \t\nand \t\nlol \t\n.";
236+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
237+
}
238+
239+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_empty_string) {
240+
char input[] = "";
241+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
242+
}
243+
244+
FOSSIL_TEST_CASE(c_test_soap_context_aware_with_null_string) {
245+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(NULL));
246+
}
247+
154248
// * * * * * * * * * * * * * * * * * * * * * * * *
155249
// * Fossil Logic Test Pool
156250
// * * * * * * * * * * * * * * * * * * * * * * * *

code/tests/cases/test_soap.cpp

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,100 @@ FOSSIL_TEST_CASE(cpp_test_soap_count_rotbrain_with_punctuation) {
130130
ASSUME_ITS_EQUAL_I32(2, fossil_soap_count_rotbrain(input));
131131
}
132132

133+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_offensive) {
134+
char input[] = "This is a test with curse1 and racist_phrase1.";
135+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
136+
}
137+
138+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_rotbrain) {
139+
char input[] = "This is a test with lol and brb.";
140+
ASSUME_ITS_EQUAL_I32(2, fossil_soap_context_aware(input));
141+
}
142+
143+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_clean) {
144+
char input[] = "This is a clean sentence.";
145+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
146+
}
147+
148+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_mixed) {
149+
char input[] = "This is a test with curse1 and lol.";
150+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
151+
}
152+
153+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_case_insensitive) {
154+
char input[] = "This is a test with CuRsE1 and LoL.";
155+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
156+
}
157+
158+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_punctuation) {
159+
char input[] = "This is a test with curse1, and lol!";
160+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
161+
}
162+
163+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_no_offensive_or_rotbrain) {
164+
char input[] = "This is a test with no offensive or rotbrain words.";
165+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
166+
}
167+
168+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_only_rotbrain) {
169+
char input[] = "This is a test with lol and brb.";
170+
ASSUME_ITS_EQUAL_I32(2, fossil_soap_context_aware(input));
171+
}
172+
173+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_only_offensive) {
174+
char input[] = "This is a test with curse1 and racist_phrase1.";
175+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
176+
}
177+
178+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_mixed_case) {
179+
char input[] = "This is a test with CuRsE1 and LoL.";
180+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
181+
}
182+
183+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_special_characters) {
184+
char input[] = "This is a test with curse1@ and lol#.";
185+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
186+
}
187+
188+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_numbers) {
189+
char input[] = "This is a test with curse1 and lol123.";
190+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
191+
}
192+
193+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_mixed_content) {
194+
char input[] = "This is a test with curse1, lol, and clean words.";
195+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
196+
}
197+
198+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_spaces) {
199+
char input[] = "This is a test with curse1 and lol .";
200+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
201+
}
202+
203+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_tabs) {
204+
char input[] = "This is a test with\tcurse1\tand\tlol\t.";
205+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
206+
}
207+
208+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_newlines) {
209+
char input[] = "This is a test with\ncurse1\nand\nlol\n.";
210+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
211+
}
212+
213+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_mixed_whitespace) {
214+
char input[] = "This is a test with \t\ncurse1 \t\nand \t\nlol \t\n.";
215+
ASSUME_ITS_EQUAL_I32(1, fossil_soap_context_aware(input));
216+
}
217+
218+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_empty_string) {
219+
char input[] = "";
220+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(input));
221+
}
222+
223+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_null_string) {
224+
ASSUME_ITS_EQUAL_I32(0, fossil_soap_context_aware(NULL));
225+
}
226+
133227
FOSSIL_TEST_CASE(cpp_test_soap_sanitize_empty_string) {
134228
char input[] = "";
135229
char expected[] = "";
@@ -194,6 +288,45 @@ FOSSIL_TEST_CASE(cpp_test_soap_sanitize_with_punctuation) {
194288
ASSUME_ITS_EQUAL_CSTR(expected, input);
195289
}
196290

291+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_numbers_and_special_characters) {
292+
char input[] = "This is a test with curse1@123 and lol#456.";
293+
ASSUME_ITS_EQUAL_I32(1, fossil::io::Soap::context_aware(input));
294+
}
295+
296+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_mixed_case_and_punctuation) {
297+
char input[] = "This is a test with CuRsE1! and LoL?.";
298+
ASSUME_ITS_EQUAL_I32(1, fossil::io::Soap::context_aware(input));
299+
}
300+
301+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_multiple_offensive_and_rotbrain) {
302+
char input[] = "This is a test with curse1, curse2, lol, and brb.";
303+
ASSUME_ITS_EQUAL_I32(2, fossil::io::Soap::context_aware(input));
304+
}
305+
306+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_only_special_characters) {
307+
char input[] = "!@#$%^&*()";
308+
ASSUME_ITS_EQUAL_I32(0, fossil::io::Soap::context_aware(input));
309+
}
310+
311+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_only_numbers) {
312+
char input[] = "1234567890";
313+
ASSUME_ITS_EQUAL_I32(0, fossil::io::Soap::context_aware(input));
314+
}
315+
316+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_mixed_numbers_and_words) {
317+
char input[] = "This is a test with 123curse1 and 456lol.";
318+
ASSUME_ITS_EQUAL_I32(1, fossil::io::Soap::context_aware(input));
319+
}
320+
321+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_unicode_characters) {
322+
char input[] = "This is a test with curse1 and lol 😊.";
323+
ASSUME_ITS_EQUAL_I32(1, fossil::io::Soap::context_aware(input));
324+
}
325+
326+
FOSSIL_TEST_CASE(cpp_test_soap_context_aware_with_long_text) {
327+
char input[] = "This is a very long test with multiple curse1, curse2, lol, and brb words to check the performance and accuracy of the context aware method.";
328+
ASSUME_ITS_EQUAL_I32(2, fossil::io::Soap::context_aware(input));
329+
}
197330

198331
// * * * * * * * * * * * * * * * * * * * * * * * *
199332
// * Fossil Logic Test Pool
@@ -212,6 +345,25 @@ FOSSIL_TEST_GROUP(cpp_soap_tests) {
212345
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_is_rotbrain_case_insensitive);
213346
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_count_rotbrain_mixed_case);
214347
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_sanitize_synonyms);
348+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_offensive);
349+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_rotbrain);
350+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_clean);
351+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_mixed);
352+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_case_insensitive);
353+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_punctuation);
354+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_no_offensive_or_rotbrain);
355+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_only_rotbrain);
356+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_only_offensive);
357+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_mixed_case);
358+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_special_characters);
359+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_numbers);
360+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_mixed_content);
361+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_spaces);
362+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_tabs);
363+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_newlines);
364+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_mixed_whitespace);
365+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_empty_string);
366+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_null_string);
215367

216368
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_sanitize_empty_string);
217369
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_sanitize_only_offensive);
@@ -223,6 +375,14 @@ FOSSIL_TEST_GROUP(cpp_soap_tests) {
223375
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_count_offensive_mixed_content);
224376
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_count_rotbrain_mixed_content);
225377
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_sanitize_with_punctuation);
378+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_numbers_and_special_characters);
379+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_mixed_case_and_punctuation);
380+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_multiple_offensive_and_rotbrain);
381+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_only_special_characters);
382+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_only_numbers);
383+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_mixed_numbers_and_words);
384+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_unicode_characters);
385+
FOSSIL_TEST_ADD(cpp_soap_suite, cpp_test_soap_context_aware_with_long_text);
226386

227387
FOSSIL_TEST_REGISTER(cpp_soap_suite);
228388
}

0 commit comments

Comments
 (0)