Skip to content

Commit 84cf066

Browse files
committed
test refactor
1 parent 7c528b4 commit 84cf066

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

test/padding.jl

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ end
1919
test_vector = Vector{UInt8}([1,2,3])
2020
Random.seed!(42)
2121
padded = ToyPublicKeys.pad(ToyPublicKeys.pkcs1_v1_5, test_vector)
22-
@test ToyPublicKeys.unpad(ToyPublicKeys.pkcs1_v1_5, padded) == test_vector
22+
unpadded = ToyPublicKeys.unpad(ToyPublicKeys.pkcs1_v1_5, padded)
23+
@test unpadded == test_vector
2324
end
2425

2526
@testset "padding/pkcs_1_v2_2 pad(unpad) is identity" begin
26-
test_vector = Vector{UInt8}([1,2,3])
27+
test_vector = Vector{UInt8}([3,2,1])
2728
Random.seed!(42)
2829
private_key, public_key = ToyPublicKeys.generate_rsa_key_pair(ToyPublicKeys.pkcs1_v1_5, 2048)
2930
padded = ToyPublicKeys.pad(ToyPublicKeys.pkcs1_v2_2,
3031
test_vector,
3132
public_key)
32-
@test test_vector == ToyPublicKeys.unpad(ToyPublicKeys.pkcs1_v2_2,
33-
padded,
34-
public_key)
33+
unpadded = ToyPublicKeys.unpad(ToyPublicKeys.pkcs1_v2_2,
34+
padded,
35+
public_key)
36+
@test unpadded == test_vector
3537
end

test/runtests.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using ToyPublicKeys
22
using Test
33
import Random
44

5+
include("utils.jl")
6+
include("padding.jl")
57
include("rsa.jl")
68
include("dh.jl")
7-
include("padding.jl")
8-
include("utils.jl")

0 commit comments

Comments
 (0)