Skip to content

Commit d2face5

Browse files
committed
Finish updating KRYPTO test suite to use Bytes
1 parent 8c862de commit d2face5

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

kore/test/Test/Kore/Builtin/Definition.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,8 @@ kryptoModule =
17461746
{ moduleName = kryptoModuleName
17471747
, moduleAttributes = Attributes []
17481748
, moduleSentences =
1749-
[ importParsedModule stringModuleName
1749+
[ importParsedModule bytesModuleName
1750+
, importParsedModule stringModuleName
17501751
, importParsedModule intModuleName
17511752
, importParsedModule listModuleName
17521753
, hookedSymbolDecl ecdsaRecoverSymbol

kore/test/Test/Kore/Builtin/Krypto.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ test_ecdsaRecover =
7272
where
7373
test messageHash v r s result =
7474
testCase (Text.unpack name) $ do
75-
let expect = InternalBytes.asPattern internalBytesSort (BS.pack result)
75+
let expect = InternalBytes.asPattern bytesSort (BS.pack result)
7676
actual <-
7777
ecdsaRecoverKrypto
78-
(InternalBytes.asInternal internalBytesSort (BS.pack messageHash))
78+
(InternalBytes.asInternal bytesSort (BS.pack messageHash))
7979
(Test.Int.asInternal v)
80-
(InternalBytes.asInternal internalBytesSort (BS.pack r))
81-
(InternalBytes.asInternal internalBytesSort (BS.pack s))
80+
(InternalBytes.asInternal bytesSort (BS.pack r))
81+
(InternalBytes.asInternal bytesSort (BS.pack s))
8282
& evaluate "KRYPTO.ecdsaRecover"
8383
assertEqual "" expect actual
8484
where
@@ -104,13 +104,13 @@ test_secp256k1EcdsaRecover =
104104
where
105105
test messageHash v r s result =
106106
testCase (Text.unpack name) $ do
107-
let expect = String.asPattern stringSort result
107+
let expect = InternalBytes.asPattern bytesSort (BS.pack result)
108108
actual <-
109109
ecdsaRecoverKrypto
110-
(String.asInternal stringSort messageHash)
110+
(InternalBytes.asInternal bytesSort (BS.pack messageHash))
111111
(Test.Int.asInternal v)
112-
(String.asInternal stringSort r)
113-
(String.asInternal stringSort s)
112+
(InternalBytes.asInternal bytesSort (BS.pack r))
113+
(InternalBytes.asInternal bytesSort (BS.pack s))
114114
& evaluate "SECP256K1.ecdsaRecover"
115115
assertEqual "" expect actual
116116
where
@@ -133,7 +133,7 @@ test_keccak256 =
133133
testCase (show input) $ do
134134
let expect = String.asPattern stringSort result
135135
actual <-
136-
keccak256Krypto (String.asInternal stringSort input)
136+
keccak256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
137137
& evaluate "KRYPTO.keccak256"
138138
assertEqual "" expect actual
139139

@@ -152,7 +152,7 @@ test_hashKeccak256 =
152152
testCase (show input) $ do
153153
let expect = String.asPattern stringSort result
154154
actual <-
155-
keccak256Krypto (String.asInternal stringSort input)
155+
keccak256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
156156
& evaluate "HASH.keccak256"
157157
assertEqual "" expect actual
158158

@@ -171,7 +171,7 @@ test_sha256 =
171171
testCase (show input) $ do
172172
let expect = String.asPattern stringSort result
173173
actual <-
174-
sha256Krypto (String.asInternal stringSort input)
174+
sha256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
175175
& evaluate "KRYPTO.sha256"
176176
assertEqual "" expect actual
177177

@@ -190,7 +190,7 @@ test_hashSha256 =
190190
testCase (show input) $ do
191191
let expect = String.asPattern stringSort result
192192
actual <-
193-
sha256Krypto (String.asInternal stringSort input)
193+
sha256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
194194
& evaluate "HASH.sha256"
195195
assertEqual "" expect actual
196196

@@ -209,7 +209,7 @@ test_sha3256 =
209209
testCase (show input) $ do
210210
let expect = String.asPattern stringSort result
211211
actual <-
212-
sha3256Krypto (String.asInternal stringSort input)
212+
sha3256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
213213
& evaluate "KRYPTO.sha3256"
214214
assertEqual "" expect actual
215215

@@ -228,7 +228,7 @@ test_hashSha3_256 =
228228
testCase (show input) $ do
229229
let expect = String.asPattern stringSort result
230230
actual <-
231-
sha3256Krypto (String.asInternal stringSort input)
231+
sha3256Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
232232
& evaluate "HASH.sha3_256"
233233
assertEqual "" expect actual
234234

@@ -253,7 +253,7 @@ test_ripemd160 =
253253
testCase (show input) $ do
254254
let expect = String.asPattern stringSort result
255255
actual <-
256-
ripemd160Krypto (String.asInternal stringSort input)
256+
ripemd160Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
257257
& evaluate "KRYPTO.ripemd160"
258258
assertEqual "" expect actual
259259

@@ -278,7 +278,7 @@ test_hashRipemd160 =
278278
testCase (show input) $ do
279279
let expect = String.asPattern stringSort result
280280
actual <-
281-
ripemd160Krypto (String.asInternal stringSort input)
281+
ripemd160Krypto (InternalBytes.asInternal bytesSort (BS.pack input))
282282
& evaluate "HASH.ripemd160"
283283
assertEqual "" expect actual
284284

0 commit comments

Comments
 (0)