@@ -27,7 +27,7 @@ FOSSIL_TEST_SUITE(c_soap_suite);
2727
2828// Setup function for the test suite
2929FOSSIL_SETUP (c_soap_suite ) {
30- fossil_io_soap_create ();
30+ // Setup code here
3131}
3232
3333// Teardown function for the test suite
@@ -43,215 +43,205 @@ FOSSIL_TEARDOWN(c_soap_suite) {
4343// as samples for library usage.
4444// * * * * * * * * * * * * * * * * * * * * * * * *
4545
46- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_no_offensive ) {
47- char input [] = "This is a clean sentence." ;
48- char expected [] = "This is a clean sentence." ;
49- char * sanitized = fossil_io_soap_sanitize (input );
50- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
51- }
52-
53- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_offensive ) {
54- char input [] = "This is a test with curse1 and racist_phrase1." ;
55- char expected [] = "This is a test with *** and ***." ;
56- char * sanitized = fossil_io_soap_sanitize (input );
57- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
58- }
59-
60- FOSSIL_TEST_CASE (c_test_io_soap_is_offensive_true ) {
61- const char * word = "curse1" ;
62- int32_t result = fossil_io_soap_is_offensive (word );
63- ASSUME_ITS_EQUAL_I32 (EXIT_FAILURE , result );
64- }
65-
66- FOSSIL_TEST_CASE (c_test_io_soap_is_offensive_false ) {
67- const char * word = "hello" ;
68- int32_t result = fossil_io_soap_is_offensive (word );
69- ASSUME_ITS_EQUAL_I32 (EXIT_SUCCESS , result );
46+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize ) {
47+ const char * input = "This is a rot-brain sentence." ;
48+ const char * expected = "This is a stupid sentence." ;
49+ char * result = fossil_io_soap_sanitize (input );
50+ ASSUME_ITS_EQUAL_CSTR (expected , result );
51+ free (result );
7052}
7153
72- FOSSIL_TEST_CASE (c_test_io_soap_is_rotbrain_true ) {
73- const char * word = "meme1" ;
74- int32_t result = fossil_io_soap_is_rotbrain (word );
75- ASSUME_ITS_EQUAL_I32 (EXIT_FAILURE , result );
76- }
77-
78- FOSSIL_TEST_CASE (c_test_io_soap_is_rotbrain_false ) {
79- const char * word = "normal" ;
80- int32_t result = fossil_io_soap_is_rotbrain (word );
81- ASSUME_ITS_EQUAL_I32 (EXIT_SUCCESS , result );
82- }
83-
84- FOSSIL_TEST_CASE (c_test_io_soap_count_offensive ) {
85- const char * input = "This is a test with curse1 and racist_phrase1." ;
86- int32_t result = fossil_io_soap_count_offensive (input );
87- ASSUME_ITS_EQUAL_I32 (2 , result );
88- }
89-
90- FOSSIL_TEST_CASE (c_test_io_soap_count_rotbrain ) {
91- const char * input = "This is a test with meme1 and meme2." ;
92- int32_t result = fossil_io_soap_count_rotbrain (input );
93- ASSUME_ITS_EQUAL_I32 (2 , result );
54+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_no_offensive ) {
55+ const char * input = "This is a clean sentence." ;
56+ const char * expected = "This is a clean sentence." ;
57+ char * result = fossil_io_soap_sanitize (input );
58+ ASSUME_ITS_EQUAL_CSTR (expected , result );
59+ free (result );
9460}
9561
96- FOSSIL_TEST_CASE (c_test_io_soap_count_positive ) {
97- const char * input = "This is a wonderful and amazing day." ;
98- int32_t result = fossil_io_soap_count_positive (input );
99- ASSUME_ITS_EQUAL_I32 (2 , result );
62+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_punctuation ) {
63+ const char * input = "This is a test with punctuation, and special characters!" ;
64+ const char * expected = "This is a test with punctuation, and special characters!" ;
65+ char * result = fossil_io_soap_sanitize (input );
66+ ASSUME_ITS_EQUAL_CSTR (expected , result );
67+ free (result );
10068}
10169
102- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_offensive_punctuation ) {
103- char input [] = "This is a test with curse1, and racist_phrase1!" ;
104- char expected [] = "This is a test with ***, and ***!" ;
105- char * sanitized = fossil_io_soap_sanitize (input );
106- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
70+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_empty_input ) {
71+ const char * input = "" ;
72+ const char * expected = "" ;
73+ char * result = fossil_io_soap_sanitize (input );
74+ ASSUME_ITS_EQUAL_CSTR (expected , result );
75+ free (result );
10776}
10877
109- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_rotbrain ) {
110- char input [] = "This is a test with rizz and yeet." ;
111- char expected [] = "This is a test with [ROT] and [ROT]." ;
112- char * sanitized = fossil_io_soap_sanitize (input );
113- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
78+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_only_whitespace ) {
79+ const char * input = " " ;
80+ const char * expected = " " ;
81+ char * result = fossil_io_soap_sanitize (input );
82+ ASSUME_ITS_EQUAL_CSTR (expected , result );
83+ free (result );
11484}
11585
116- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_rotbrain_punctuation ) {
117- char input [] = "This is a test with rizz, and yeet!" ;
118- char expected [] = "This is a test with [ROT], and [ROT]!" ;
119- char * sanitized = fossil_io_soap_sanitize (input );
120- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
86+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_long_input ) {
87+ const char * input = "This is an extremely lengthy input string that surpasses the buffer limit" ;
88+ const char * expected = "This is an extremely lengthy input string that surpasses the buffer limit" ;
89+ char * result = fossil_io_soap_sanitize (input );
90+ ASSUME_ITS_EQUAL_CSTR (expected , result );
91+ free (result );
12192}
12293
123- FOSSIL_TEST_CASE (c_test_io_soap_is_offensive_with_punctuation ) {
124- const char * word = "curse1!" ;
125- int32_t result = fossil_io_soap_is_offensive (word );
126- ASSUME_ITS_EQUAL_I32 (EXIT_FAILURE , result );
94+ FOSSIL_TEST_CASE (c_test_io_soap_suggest ) {
95+ const char * input = "This is a rot-brain sentence." ;
96+ const char * expected = "This is a stupid sentence." ;
97+ char * result = fossil_io_soap_suggest (input , '*' );
98+ ASSUME_ITS_EQUAL_CSTR (expected , result );
99+ free (result );
127100}
128101
129- FOSSIL_TEST_CASE (c_test_io_soap_is_rotbrain_with_punctuation ) {
130- const char * word = "rizz!" ;
131- int32_t result = fossil_io_soap_is_rotbrain (word );
132- ASSUME_ITS_EQUAL_I32 (EXIT_FAILURE , result );
102+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_no_offensive ) {
103+ const char * input = "This is a clean sentence." ;
104+ const char * expected = "This is a clean sentence." ;
105+ char * result = fossil_io_soap_suggest (input , '*' );
106+ ASSUME_ITS_EQUAL_CSTR (expected , result );
107+ free (result );
133108}
134109
135- FOSSIL_TEST_CASE (c_test_io_soap_count_offensive_with_punctuation ) {
136- const char * input = "This is a test with curse1, and racist_phrase1! " ;
137- int32_t result = fossil_io_soap_count_offensive ( input );
138- ASSUME_ITS_EQUAL_I32 (2 , result );
110+ FOSSIL_TEST_CASE (c_test_io_soap_add_custom_filter ) {
111+ const char * phrase = "custom " ;
112+ int result = fossil_io_soap_add_custom_filter ( phrase );
113+ ASSUME_ITS_EQUAL_I32 (0 , result );
139114}
140115
141- FOSSIL_TEST_CASE (c_test_io_soap_count_rotbrain_with_punctuation ) {
142- const char * input = "This is a test with rizz, and yeet!" ;
143- int32_t result = fossil_io_soap_count_rotbrain (input );
144- ASSUME_ITS_EQUAL_I32 (2 , result );
116+ FOSSIL_TEST_CASE (c_test_io_soap_detect_tone_sarcastic ) {
117+ const char * input = "Oh, great. Another meeting." ;
118+ const char * expected = "sarcastic" ;
119+ const char * result = fossil_io_soap_detect_tone (input );
120+ ASSUME_ITS_EQUAL_CSTR (expected , result );
145121}
146122
147- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_empty_string ) {
148- char input [] = "" ;
149- char expected [] = "" ;
150- char * sanitized = fossil_io_soap_sanitize (input );
151- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
123+ FOSSIL_TEST_CASE (c_test_io_soap_detect_tone_formal ) {
124+ const char * input = "Dear Sir or Madam, " ;
125+ const char * expected = "formal " ;
126+ const char * result = fossil_io_soap_detect_tone (input );
127+ ASSUME_ITS_EQUAL_CSTR (expected , result );
152128}
153129
154- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_only_offensive ) {
155- char input [] = "curse1 " ;
156- char expected [] = "*** " ;
157- char * sanitized = fossil_io_soap_sanitize (input );
158- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
130+ FOSSIL_TEST_CASE (c_test_io_soap_detect_tone_casual ) {
131+ const char * input = "Hey, what's up? " ;
132+ const char * expected = "casual " ;
133+ const char * result = fossil_io_soap_detect_tone (input );
134+ ASSUME_ITS_EQUAL_CSTR (expected , result );
159135}
160136
161- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_only_rotbrain ) {
162- char input [] = "rizz" ;
163- char expected [] = "[ROT]" ;
164- char * sanitized = fossil_io_soap_sanitize (input );
165- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
137+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_leetspeak ) {
138+ const char * input = "Th1s 1s 4 l33tspeak s3nt3nc3." ;
139+ const char * expected = "This is a leetspeak sentence." ;
140+ char * result = fossil_io_soap_sanitize (input );
141+ ASSUME_ITS_EQUAL_CSTR (expected , result );
142+ free (result );
166143}
167144
168145FOSSIL_TEST_CASE (c_test_io_soap_sanitize_mixed_case ) {
169- char input [] = "CurSe1 and Racist_Phrase1" ;
170- char expected [] = "*** and ***" ;
171- char * sanitized = fossil_io_soap_sanitize (input );
172- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
146+ const char * input = "This Is A Rot-Brain Sentence." ;
147+ const char * expected = "This Is A stupid Sentence." ;
148+ char * result = fossil_io_soap_sanitize (input );
149+ ASSUME_ITS_EQUAL_CSTR (expected , result );
150+ free (result );
173151}
174152
175- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_numbers ) {
176- char input [] = "This is a test with curse1 and 123." ;
177- char expected [] = "This is a test with *** and 123." ;
178- char * sanitized = fossil_io_soap_sanitize (input );
179- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
153+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_special_chars ) {
154+ const char * input = "This is a test with special chars #$%^&*!" ;
155+ const char * expected = "This is a test with special chars #$%^&*!" ;
156+ char * result = fossil_io_soap_sanitize (input );
157+ ASSUME_ITS_EQUAL_CSTR (expected , result );
158+ free (result );
180159}
181160
182- FOSSIL_TEST_CASE (c_test_io_soap_is_offensive_empty_string ) {
183- const char * word = "" ;
184- int32_t result = fossil_io_soap_is_offensive (word );
185- ASSUME_ITS_EQUAL_I32 (EXIT_SUCCESS , result );
161+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_newlines ) {
162+ const char * input = "This is a test\nwith newlines." ;
163+ const char * expected = "This is a test\nwith newlines." ;
164+ char * result = fossil_io_soap_sanitize (input );
165+ ASSUME_ITS_EQUAL_CSTR (expected , result );
166+ free (result );
186167}
187168
188- FOSSIL_TEST_CASE (c_test_io_soap_is_rotbrain_empty_string ) {
189- const char * word = "" ;
190- int32_t result = fossil_io_soap_is_rotbrain (word );
191- ASSUME_ITS_EQUAL_I32 (EXIT_SUCCESS , result );
169+ FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_tabs ) {
170+ const char * input = "This is a test\twith tabs." ;
171+ const char * expected = "This is a test\twith tabs." ;
172+ char * result = fossil_io_soap_sanitize (input );
173+ ASSUME_ITS_EQUAL_CSTR (expected , result );
174+ free (result );
192175}
193176
194- FOSSIL_TEST_CASE (c_test_io_soap_count_offensive_empty_string ) {
195- const char * input = "" ;
196- int32_t result = fossil_io_soap_count_offensive (input );
197- ASSUME_ITS_EQUAL_I32 (0 , result );
177+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_leetspeak ) {
178+ const char * input = "Th1s 1s 4 l33tspeak s3nt3nc3." ;
179+ const char * expected = "This is a leetspeak sentence." ;
180+ char * result = fossil_io_soap_suggest (input , '*' );
181+ ASSUME_ITS_EQUAL_CSTR (expected , result );
182+ free (result );
198183}
199184
200- FOSSIL_TEST_CASE (c_test_io_soap_count_rotbrain_empty_string ) {
201- const char * input = "" ;
202- int32_t result = fossil_io_soap_count_rotbrain (input );
203- ASSUME_ITS_EQUAL_I32 (0 , result );
185+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_mixed_case ) {
186+ const char * input = "This Is A Rot-Brain Sentence." ;
187+ const char * expected = "This Is A stupid Sentence." ;
188+ char * result = fossil_io_soap_suggest (input , '*' );
189+
190+ ASSUME_ITS_EQUAL_CSTR (expected , result );
191+ free (result );
204192}
205193
206- FOSSIL_TEST_CASE (c_test_io_soap_count_offensive_no_offensive ) {
207- const char * input = "This is a clean sentence." ;
208- int32_t result = fossil_io_soap_count_offensive (input );
209- ASSUME_ITS_EQUAL_I32 (0 , result );
194+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_with_special_chars ) {
195+ const char * input = "This is a test with special chars #$%^&*!" ;
196+ const char * expected = "This is a test with special chars #$%^&*!" ;
197+ char * result = fossil_io_soap_suggest (input , '*' );
198+ ASSUME_ITS_EQUAL_CSTR (expected , result );
199+ free (result );
210200}
211201
212- FOSSIL_TEST_CASE (c_test_io_soap_count_rotbrain_no_rotbrain ) {
213- const char * input = "This is a clean sentence." ;
214- int32_t result = fossil_io_soap_count_rotbrain (input );
215- ASSUME_ITS_EQUAL_I32 (0 , result );
202+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_with_newlines ) {
203+ const char * input = "This is a test\nwith newlines." ;
204+ const char * expected = "This is a test\nwith newlines." ;
205+ char * result = fossil_io_soap_suggest (input , '*' );
206+ ASSUME_ITS_EQUAL_CSTR (expected , result );
207+ free (result );
216208}
217209
218- FOSSIL_TEST_CASE (c_test_io_soap_sanitize_with_mixed_offensive_rotbrain ) {
219- char input [] = "This is a test with curse1 and rizz." ;
220- char expected [] = "This is a test with *** and [ROT]." ;
221- char * sanitized = fossil_io_soap_sanitize (input );
222- ASSUME_ITS_EQUAL_CSTR (expected , sanitized );
210+ FOSSIL_TEST_CASE (c_test_io_soap_suggest_with_tabs ) {
211+ const char * input = "This is a test\twith tabs." ;
212+ const char * expected = "This is a test\twith tabs." ;
213+ char * result = fossil_io_soap_suggest (input , '*' );
214+ ASSUME_ITS_EQUAL_CSTR (expected , result );
215+ free (result );
223216}
224217
225218// * * * * * * * * * * * * * * * * * * * * * * * *
226219// * Fossil Logic Test Pool
227220// * * * * * * * * * * * * * * * * * * * * * * * *
228221
229222FOSSIL_TEST_GROUP (c_soap_tests ) {
223+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize );
230224 FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_no_offensive );
231- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_with_offensive);
232- FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_is_offensive_true );
233- FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_is_offensive_false );
234- FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_is_rotbrain_true );
235- FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_is_rotbrain_false );
236- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_offensive);
237- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_rotbrain);
238- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_positive);
239- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_with_offensive_punctuation);
240- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_with_rotbrain);
241- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_with_rotbrain_punctuation);
242- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_is_offensive_with_punctuation);
243- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_is_rotbrain_with_punctuation);
244- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_offensive_with_punctuation);
245- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_rotbrain_with_punctuation);
246- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_empty_string);
247- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_only_offensive);
248- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_only_rotbrain);
249- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_mixed_case);
250- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_sanitize_with_numbers);
251- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_is_offensive_empty_string);
252- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_is_rotbrain_empty_string);
253- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_offensive_empty_string);
254- // FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_count_rotbrain_empty_string);
225+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_with_punctuation );
226+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_empty_input );
227+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_only_whitespace );
228+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_long_input );
229+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest );
230+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_no_offensive );
231+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_add_custom_filter );
232+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_detect_tone_sarcastic );
233+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_detect_tone_formal );
234+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_detect_tone_casual );
235+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_leetspeak );
236+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_mixed_case );
237+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_with_special_chars );
238+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_with_newlines );
239+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_sanitize_with_tabs );
240+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_leetspeak );
241+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_mixed_case );
242+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_with_special_chars );
243+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_with_newlines );
244+ FOSSIL_TEST_ADD (c_soap_suite , c_test_io_soap_suggest_with_tabs );
255245
256246 FOSSIL_TEST_REGISTER (c_soap_suite );
257247}
0 commit comments