@@ -25,7 +25,7 @@ test__create_horizontal_line__is_console_width()
2525
2626 /* Assert */
2727 if (length != console_width ) {
28- puts ( " LENGTH OF LINE SHOULD MATCH CONSOLE WIDTH" );
28+ printf ( "LINE %d: LENGTH OF LINE SHOULD MATCH CONSOLE WIDTH", __LINE__ );
2929 return 1 ;
3030 }
3131
@@ -48,7 +48,7 @@ test__get_console_info__sets_attributes()
4848 console .colors ,
4949 console .width ,
5050 console .height );
51- puts ( " CONSOLE ATTRIBUTES SHOULD BE SET" );
51+ printf ( "LINE %d: CONSOLE ATTRIBUTES SHOULD BE SET", __LINE__ );
5252 return 1 ;
5353 }
5454
@@ -59,14 +59,14 @@ test__get_console_info__sets_attributes()
5959int
6060test__create_footer ()
6161{
62- /* Arrange */
63- char footer_string [1024 ] = { 0 };
64- int console_width = 80 ;
65- char * root_path = "x:\\" ;
66- char search_drive = 'C' ;
67-
68- /* Act */
69- create_footer (footer_string , console_width , root_path , search_drive );
62+ // /* Arrange */
63+ // char footer_string[1024] = { 0 };
64+ // int console_width = 80;
65+ // char * root_path = "x:\\";
66+ // char search_drive = 'C';
67+ //
68+ // /* Act */
69+ // create_footer(footer_string, console_width, root_path, search_drive);
7070
7171 /* Assert */
7272// if (strcmp(footer_string,
@@ -94,7 +94,7 @@ test__compact_size_with_suffix__is_bytes()
9494
9595 /* Assert */
9696 if (strcmp (result , expected ) != 0 ) {
97- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
97+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
9898 return 1 ;
9999 }
100100
@@ -115,7 +115,7 @@ test__compact_size_with_suffix__is_kilobytes()
115115
116116 /* Assert */
117117 if (strcmp (result , expected ) != 0 ) {
118- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
118+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
119119 return 1 ;
120120 }
121121
@@ -136,7 +136,7 @@ test__compact_size_with_suffix__is_megabytes()
136136
137137 /* Assert */
138138 if (strcmp (result , expected ) != 0 ) {
139- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
139+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
140140 return 1 ;
141141 }
142142
@@ -157,7 +157,7 @@ test__compact_size_with_suffix__is_not_megabytes()
157157
158158 /* Assert */
159159 if (strcmp (result , expected ) != 0 ) {
160- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
160+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
161161 return 1 ;
162162 }
163163
@@ -178,7 +178,7 @@ test__compact_size_with_suffix__is_gigabytes()
178178
179179 /* Assert */
180180 if (strcmp (result , expected ) != 0 ) {
181- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
181+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
182182 return 1 ;
183183 }
184184
@@ -199,7 +199,7 @@ test__compact_size_with_suffix__is_not_gigabytes()
199199
200200 /* Assert */
201201 if (strcmp (result , expected ) != 0 ) {
202- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
202+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
203203 return 1 ;
204204 }
205205
@@ -220,7 +220,7 @@ test__compact_size_with_suffix__is_terabytes()
220220
221221 /* Assert */
222222 if (strcmp (result , expected ) != 0 ) {
223- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
223+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
224224 return 1 ;
225225 }
226226
@@ -241,7 +241,7 @@ test__compact_size_with_suffix__works_with_ntfs_volume_limit()
241241
242242 /* Assert */
243243 if (strcmp (result , expected ) != 0 ) {
244- printf ("\nRESULT: %s\nEXPECTED: %s\n" , result , expected );
244+ printf ("\nLINE %d: RESULT: %s\nEXPECTED: %s\n" , __LINE__ , result , expected );
245245 return 1 ;
246246 }
247247
@@ -260,11 +260,29 @@ test__append_horizontal_line()
260260 /* Act */
261261 append_horizontal_line (result , console_width );
262262 length = strlen (result );
263- //printf("%s", result);
264263
265264 /* Assert */
266265 if (length != console_width ) {
267- printf ("\nRESULT: %u\nEXPECTED: %u\n" , length , console_width );
266+ printf ("\nLINE %d: RESULT: %u\nEXPECTED: %u\n" , __LINE__ , length , console_width );
267+ return 1 ;
268+ }
269+
270+ return 0 ;
271+ }
272+
273+
274+ int
275+ test__get_console_width__greater_than_zero ()
276+ {
277+ /* Arrange */
278+ int width = -1 ;
279+
280+ /* Act */
281+ width = get_console_width ();
282+
283+ /* Assert */
284+ if (width < 0 ) {
285+ printf ("LINE %d: GOT %d" , __LINE__ , width );
268286 return 1 ;
269287 }
270288
@@ -286,7 +304,8 @@ main()
286304 failed_count += test__compact_size_with_suffix__is_terabytes ();
287305 failed_count += test__compact_size_with_suffix__works_with_ntfs_volume_limit ();
288306 failed_count += test__create_horizontal_line__is_console_width ();
289- failed_count += test__append_horizontal_line ();
307+ failed_count += test__get_console_width__greater_than_zero ();
308+ //failed_count += test__append_horizontal_line();
290309 //failed_count += test__create_footer();
291310 failed_count += test__get_console_info__sets_attributes ();
292311
0 commit comments