Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions exercises/practice/crypto-square/.meta/Example.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ Imports System.Runtime.CompilerServices

Friend Module Crypto
Public Function Ciphertext(plaintext As String) As String
If plaintext.Length = 0
Dim normalized = plaintext.Normalized()
If normalized.Length = 0
Return ""
Else
Return String.Join(" ", plaintext.Normalized().Rows().Columns())
Return String.Join(" ", normalized.Rows().Columns())
End If
End Function

Expand Down Expand Up @@ -38,4 +39,4 @@ Friend Module Crypto
Yield str.Substring(i, Math.Min(str.Length - i, size))
Next
End Function
End Module
End Module
7 changes: 5 additions & 2 deletions exercises/practice/crypto-square/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
[407c3837-9aa7-4111-ab63-ec54b58e8e9f]
description = "empty plaintext results in an empty ciphertext"

[aad04a25-b8bb-4304-888b-581bea8e0040]
description = "normalization results in empty plaintext"

[64131d65-6fd9-4f58-bdd8-4a2370fb481d]
description = "Lowercase"

Expand All @@ -26,5 +29,5 @@ description = "9 character plaintext results in 3 chunks of 3 characters"
[a65d3fa1-9e09-43f9-bcec-7a672aec3eae]
description = "8 character plaintext results in 3 chunks, the last one with a trailing space"

[fbcb0c6d-4c39-4a31-83f6-c473baa6af80]
description = "54 character plaintext results in 7 chunks, the last two with trailing spaces"
[33fd914e-fa44-445b-8f38-ff8fbc9fe6e6]
description = "54 character plaintext results in 8 chunks, the last two with trailing spaces"
10 changes: 8 additions & 2 deletions exercises/practice/crypto-square/CryptoSquareTests.vb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Public Class CryptoSquareTest
Assert.Equal("", Ciphertext(plaintext))
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub NormalizationResultsInEmptyPlaintext()
Dim plaintext = "... --- ..."
Assert.Equal("", Ciphertext(plaintext))
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub Lowercase()
Dim plaintext = "A"
Expand Down Expand Up @@ -36,8 +42,8 @@ Public Class CryptoSquareTest
End Sub

<Fact(Skip:="Remove this Skip property to run this test")>
Public Sub FiftyFourCharacterPlaintextResultsInSevenChunksTheTwoWithTrailingSpaces()
Public Sub FiftyFourCharacterPlaintextResultsInEightChunksTheTwoWithTrailingSpaces()
Dim plaintext = "If man was meant to stay on the ground, god would have given us roots."
Assert.Equal("imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ", Ciphertext(plaintext))
End Sub
End Class
End Class
Loading