@@ -3,58 +3,62 @@ const testing = std.testing;
33
44const isogram = @import ("isogram.zig" );
55
6+ fn testIsIsogram (phrase : []const u8 , expected : bool ) ! void {
7+ try testing .expectEqual (expected , isogram .isIsogram (phrase ));
8+ }
9+
610test "empty string" {
7- try testing . expect ( isogram . isIsogram ( "" ) );
11+ try testIsIsogram ( "" , true );
812}
913
1014test "isogram with only lower case characters" {
11- try testing . expect ( isogram . isIsogram ( "isogram" ) );
15+ try testIsIsogram ( "isogram" , true );
1216}
1317
1418test "word with one duplicated character" {
15- try testing . expect ( ! isogram . isIsogram ( "eleven" ) );
19+ try testIsIsogram ( "eleven" , false );
1620}
1721
1822test "word with one duplicated character from the end of the alphabet" {
19- try testing . expect ( ! isogram . isIsogram ( "zzyzx" ) );
23+ try testIsIsogram ( "zzyzx" , false );
2024}
2125
2226test "longest reported english isogram" {
23- try testing . expect ( isogram . isIsogram ( "subdermatoglyphic" ) );
27+ try testIsIsogram ( "subdermatoglyphic" , true );
2428}
2529
2630test "word with duplicated character in mixed case" {
27- try testing . expect ( ! isogram . isIsogram ( "Alphabet" ) );
31+ try testIsIsogram ( "Alphabet" , false );
2832}
2933
3034test "word with duplicated character in mixed case, lowercase first" {
31- try testing . expect ( ! isogram . isIsogram ( "alphAbet" ) );
35+ try testIsIsogram ( "alphAbet" , false );
3236}
3337
3438test "hypothetical isogrammic word with hyphen" {
35- try testing . expect ( isogram . isIsogram ( "thumbscrew-japingly" ) );
39+ try testIsIsogram ( "thumbscrew-japingly" , true );
3640}
3741
3842test "hypothetical word with duplicated character following hyphen" {
39- try testing . expect ( ! isogram . isIsogram ( "thumbscrew-jappingly" ) );
43+ try testIsIsogram ( "thumbscrew-jappingly" , false );
4044}
4145
4246test "isogram with duplicated hyphen" {
43- try testing . expect ( isogram . isIsogram ( "six-year-old" ) );
47+ try testIsIsogram ( "six-year-old" , true );
4448}
4549
4650test "made-up name that is an isogram" {
47- try testing . expect ( isogram . isIsogram ( "Emily Jung Schwartzkopf" ) );
51+ try testIsIsogram ( "Emily Jung Schwartzkopf" , true );
4852}
4953
5054test "duplicated character in the middle" {
51- try testing . expect ( ! isogram . isIsogram ( "accentor" ) );
55+ try testIsIsogram ( "accentor" , false );
5256}
5357
5458test "same first and last characters" {
55- try testing . expect ( ! isogram . isIsogram ( "angola" ) );
59+ try testIsIsogram ( "angola" , false );
5660}
5761
5862test "word with duplicated character and with two hyphens" {
59- try testing . expect ( ! isogram . isIsogram ( "up-to-date" ) );
63+ try testIsIsogram ( "up-to-date" , false );
6064}
0 commit comments