ax(ueps): rename frame1/frame2 to frameWithSecretA/frameWithSecretB
Numeric suffixes (frame1, frame2) violate AX principle 1 — predictable names over short names. Descriptive names make the test intent clear without reading the assertions. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
017d386c6d
commit
02e60c2ab5
1 changed files with 6 additions and 6 deletions
|
|
@ -100,23 +100,23 @@ func TestPacket_MarshalAndSign_Good(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// frame1, _ := builder.MarshalAndSign([]byte("secret-a"))
|
||||
// frame2, _ := builder.MarshalAndSign([]byte("secret-b"))
|
||||
// // frame1 != frame2 (HMAC tag differs)
|
||||
// frameWithSecretA, _ := builder.MarshalAndSign([]byte("secret-a"))
|
||||
// frameWithSecretB, _ := builder.MarshalAndSign([]byte("secret-b"))
|
||||
// // frameWithSecretA != frameWithSecretB (HMAC tag differs)
|
||||
func TestPacket_MarshalAndSign_Bad(t *testing.T) {
|
||||
builder := NewBuilder(0x02, []byte("data"))
|
||||
|
||||
frame1, err := builder.MarshalAndSign([]byte("secret-a"))
|
||||
frameWithSecretA, err := builder.MarshalAndSign([]byte("secret-a"))
|
||||
if err != nil {
|
||||
t.Fatalf("MarshalAndSign(secret-a) failed: %v", err)
|
||||
}
|
||||
|
||||
frame2, err := builder.MarshalAndSign([]byte("secret-b"))
|
||||
frameWithSecretB, err := builder.MarshalAndSign([]byte("secret-b"))
|
||||
if err != nil {
|
||||
t.Fatalf("MarshalAndSign(secret-b) failed: %v", err)
|
||||
}
|
||||
|
||||
if bytes.Equal(frame1, frame2) {
|
||||
if bytes.Equal(frameWithSecretA, frameWithSecretB) {
|
||||
t.Error("expected different frames for different secrets, got identical frames")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue