-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include dilithium; clean up key types and related methods #370
Conversation
Codecov Report
@@ Coverage Diff @@
## main #370 +/- ##
==========================================
+ Coverage 59.28% 59.30% +0.02%
==========================================
Files 56 55 -1
Lines 6847 6840 -7
==========================================
- Hits 4059 4056 -3
+ Misses 2076 2074 -2
+ Partials 712 710 -2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet. Small readability suggestion.
crypto/keys_test.go
Outdated
t.Run("Able to generate dilithium key pairs for each mode", func(tt *testing.T) { | ||
tests := []struct { | ||
name string | ||
m dilithium.Mode | ||
wantErr bool | ||
}{ | ||
{ | ||
"mode2", | ||
dilithium.Mode2, | ||
false, | ||
}, | ||
{ | ||
"mode3", | ||
dilithium.Mode3, | ||
false, | ||
}, | ||
{ | ||
"mode5", | ||
dilithium.Mode5, | ||
false, | ||
}, | ||
{ | ||
"bad", | ||
nil, | ||
true, | ||
}, | ||
} | ||
for _, test := range tests { | ||
tt.Run(test.name, func(ttt *testing.T) { | ||
pk, sk, err := GenerateDilithiumKeyPair(test.m) | ||
if test.wantErr { | ||
assert.Error(ttt, err) | ||
assert.Nil(ttt, pk) | ||
assert.Nil(ttt, sk) | ||
} else { | ||
assert.NoError(ttt, err) | ||
assert.NotNil(ttt, pk) | ||
assert.NotNil(ttt, sk) | ||
} | ||
}) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: minimize branching logic inside tests. In this case I suggest separating the error case behavior into a separate test. It would make things more readable.
No description provided.