ax(ueps): rename generic 'result' to 'encodedTLV' in writeTLV tests

AX Principle 1 — predictable names over short names. 'result' does not
describe what it holds; 'encodedTLV' names the TLV-encoded byte slice
exactly, matching the function under test.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 08:55:11 +01:00
parent 0979fd1aea
commit f4dbfcc251
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -147,18 +147,18 @@ func TestPacket_writeTLV_Good(t *testing.T) {
if err != nil {
t.Fatalf("writeTLV failed: %v", err)
}
result := buffer.Bytes()
if len(result) != 3 {
t.Fatalf("expected 3 bytes, got %d", len(result))
encodedTLV := buffer.Bytes()
if len(encodedTLV) != 3 {
t.Fatalf("expected 3 bytes, got %d", len(encodedTLV))
}
if result[0] != TagVersion {
t.Errorf("expected tag 0x%02x, got 0x%02x", TagVersion, result[0])
if encodedTLV[0] != TagVersion {
t.Errorf("expected tag 0x%02x, got 0x%02x", TagVersion, encodedTLV[0])
}
if result[1] != 0x01 {
t.Errorf("expected length 1, got %d", result[1])
if encodedTLV[1] != 0x01 {
t.Errorf("expected length 1, got %d", encodedTLV[1])
}
if result[2] != 0x09 {
t.Errorf("expected value 0x09, got 0x%02x", result[2])
if encodedTLV[2] != 0x09 {
t.Errorf("expected value 0x09, got 0x%02x", encodedTLV[2])
}
}
@ -185,14 +185,14 @@ func TestPacket_writeTLV_Ugly(t *testing.T) {
if err != nil {
t.Fatalf("writeTLV with empty value failed: %v", err)
}
result := buffer.Bytes()
if len(result) != 2 {
t.Fatalf("expected 2 bytes for empty value, got %d", len(result))
encodedTLV := buffer.Bytes()
if len(encodedTLV) != 2 {
t.Fatalf("expected 2 bytes for empty value, got %d", len(encodedTLV))
}
if result[0] != TagIntent {
t.Errorf("expected tag 0x%02x, got 0x%02x", TagIntent, result[0])
if encodedTLV[0] != TagIntent {
t.Errorf("expected tag 0x%02x, got 0x%02x", TagIntent, encodedTLV[0])
}
if result[1] != 0x00 {
t.Errorf("expected length 0, got %d", result[1])
if encodedTLV[1] != 0x00 {
t.Errorf("expected length 0, got %d", encodedTLV[1])
}
}