Skip to content

Commit aee74b5

Browse files
binary: fix
1 parent feb5f14 commit aee74b5

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

bin/generate-tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $ErrorActionPreference = "Stop"
2424
$PSNativeCommandUseErrorActionPreference = $true
2525

2626
if ($Exercise) {
27-
dotnet run --project generators --exercise $Exercise
27+
dotnet run --project generators generate --exercise $Exercise
2828
} else {
29-
dotnet run --project generators
29+
dotnet run --project generators generate
3030
}

exercises/practice/binary/.meta/Generator.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class {{testClass}}
66
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}]
77
public void {{test.testMethod}}()
88
{
9-
Assert.Equal({{test.expected}}, {{testedClass}}.To{{test.testedMethod}}({{test.input.binary | string.literal}}));
9+
Assert.Equal({{if test.expected}}{{test.expected}}{{else}}0{{end}}, {{testedClass}}.To{{test.testedMethod}}({{test.input.binary | string.literal}}));
1010
}
1111
{{end}}
1212
}

exercises/practice/binary/BinaryTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,36 @@ public void Binary_ignores_leading_zeros()
5959
[Fact(Skip = "Remove this Skip property to run this test")]
6060
public void Two_is_not_a_valid_binary_digit()
6161
{
62-
Assert.Equal(, Binary.ToDecimal("2"));
62+
Assert.Equal(0, Binary.ToDecimal("2"));
6363
}
6464

6565
[Fact(Skip = "Remove this Skip property to run this test")]
6666
public void A_number_containing_a_non_binary_digit_is_invalid()
6767
{
68-
Assert.Equal(, Binary.ToDecimal("01201"));
68+
Assert.Equal(0, Binary.ToDecimal("01201"));
6969
}
7070

7171
[Fact(Skip = "Remove this Skip property to run this test")]
7272
public void A_number_with_trailing_non_binary_characters_is_invalid()
7373
{
74-
Assert.Equal(, Binary.ToDecimal("10nope"));
74+
Assert.Equal(0, Binary.ToDecimal("10nope"));
7575
}
7676

7777
[Fact(Skip = "Remove this Skip property to run this test")]
7878
public void A_number_with_leading_non_binary_characters_is_invalid()
7979
{
80-
Assert.Equal(, Binary.ToDecimal("nope10"));
80+
Assert.Equal(0, Binary.ToDecimal("nope10"));
8181
}
8282

8383
[Fact(Skip = "Remove this Skip property to run this test")]
8484
public void A_number_with_internal_non_binary_characters_is_invalid()
8585
{
86-
Assert.Equal(, Binary.ToDecimal("10nope10"));
86+
Assert.Equal(0, Binary.ToDecimal("10nope10"));
8787
}
8888

8989
[Fact(Skip = "Remove this Skip property to run this test")]
9090
public void A_number_and_a_word_whitespace_separated_is_invalid()
9191
{
92-
Assert.Equal(, Binary.ToDecimal("001 nope"));
92+
Assert.Equal(0, Binary.ToDecimal("001 nope"));
9393
}
9494
}

0 commit comments

Comments
 (0)