Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sloede committed Jun 28, 2020
1 parent 64b554a commit 7df157e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions test/test_3_levels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
end

@testset "modulus switching on encrypted (level 2)" begin
@test_nowarn mod_switch_to_next_inplace!(encrypted, evaluator)
@test mod_switch_to_next_inplace!(encrypted, evaluator) == encrypted
context_data = next_context_data(context_data)
@test chain_index(context_data) == 2
@test parms_id(context_data) == [0x85626ad91458073f,
Expand All @@ -145,7 +145,7 @@
end

@testset "modulus switching on encrypted (level 1)" begin
@test_nowarn mod_switch_to_next_inplace!(encrypted, evaluator)
@test mod_switch_to_next_inplace!(encrypted, evaluator) == encrypted
context_data = next_context_data(context_data)
@test chain_index(context_data) == 1
@test parms_id(context_data) == [0x73b7dc26d10a15b9,
Expand All @@ -156,7 +156,7 @@
end

@testset "modulus switching on encrypted (level 3)" begin
@test_nowarn mod_switch_to_next_inplace!(encrypted, evaluator)
@test mod_switch_to_next_inplace!(encrypted, evaluator) == encrypted
context_data = next_context_data(context_data)
@test chain_index(context_data) == 0
@test parms_id(context_data) == [0xaf7f6dac55528cf7,
Expand All @@ -175,19 +175,19 @@
@test_nowarn encrypt!(encrypted, plain, encryptor)
@test invariant_noise_budget(encrypted, decryptor) in (131, 132, 133)

@test_nowarn square_inplace!(encrypted, evaluator)
@test_nowarn relinearize_inplace!(encrypted, relin_keys_, evaluator)
@test square_inplace!(encrypted, evaluator) == encrypted
@test relinearize_inplace!(encrypted, relin_keys_, evaluator) == encrypted
@test invariant_noise_budget(encrypted, decryptor) in (99, 100, 101)

@test_nowarn square_inplace!(encrypted, evaluator)
@test_nowarn relinearize_inplace!(encrypted, relin_keys_, evaluator)
@test square_inplace!(encrypted, evaluator) == encrypted
@test relinearize_inplace!(encrypted, relin_keys_, evaluator) == encrypted
@test invariant_noise_budget(encrypted, decryptor) in (66, 67, 68)

@test_nowarn mod_switch_to_next_inplace!(encrypted, evaluator)
@test invariant_noise_budget(encrypted, decryptor) in (66, 67, 68)

@test_nowarn square_inplace!(encrypted, evaluator)
@test_nowarn relinearize_inplace!(encrypted, relin_keys_, evaluator)
@test square_inplace!(encrypted, evaluator) == encrypted
@test relinearize_inplace!(encrypted, relin_keys_, evaluator) == encrypted
@test invariant_noise_budget(encrypted, decryptor) in (33, 34, 35)

@test_nowarn mod_switch_to_next_inplace!(encrypted, evaluator)
Expand Down
8 changes: 4 additions & 4 deletions test/test_4_ckks_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
end

@testset "rescale_to_next_inplace!" begin
@test_nowarn rescale_to_next_inplace!(x3_encrypted, evaluator)
@test rescale_to_next_inplace!(x3_encrypted, evaluator) == x3_encrypted
end

@testset "scale (after rescaling)" begin
Expand All @@ -130,7 +130,7 @@
end

@testset "multiply_inplace!" begin
@test_nowarn multiply_inplace!(x3_encrypted, x1_encrypted_coeff3, evaluator)
@test multiply_inplace!(x3_encrypted, x1_encrypted_coeff3, evaluator) == x3_encrypted
end

@testset "relinearize_inplace! and rescale" begin
Expand Down Expand Up @@ -177,8 +177,8 @@

last_parms_id = parms_id(x3_encrypted)
@testset "mod_switch_to_inplace!" begin
@test_nowarn mod_switch_to_inplace!(x1_encrypted, last_parms_id, evaluator)
@test_nowarn mod_switch_to_inplace!(plain_coeff0, last_parms_id, evaluator)
@test mod_switch_to_inplace!(x1_encrypted, last_parms_id, evaluator) == x1_encrypted
@test mod_switch_to_inplace!(plain_coeff0, last_parms_id, evaluator) == plain_coeff0
end

encrypted_result = Ciphertext()
Expand Down

0 comments on commit 7df157e

Please sign in to comment.