Skip to content

Commit

Permalink
Fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
markwinter committed Dec 21, 2024
1 parent cab121d commit 7c88359
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion itch/5.0/ipo_quotation.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func MakeIpoQuotation(stockLocate, trackingNumber uint16, timestamp time.Duratio
StockLocate: stockLocate,
TrackingNumber: trackingNumber,
Timestamp: timestamp,
Stock: fmt.Sprintf("%-8s", stock),
Stock: stock,
ReleaseTime: releaseTime,
Qualifier: qualifier,
Price: price,
Expand Down
6 changes: 2 additions & 4 deletions itch/5.0/ipo_quotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
)

func TestMakeAndParseIpoQuotation(t *testing.T) {
Expand All @@ -18,7 +17,7 @@ func TestMakeAndParseIpoQuotation(t *testing.T) {
StockLocate: 0,
TrackingNumber: 1,
Timestamp: timeSinceMidnight,
Stock: "AAPL ",
Stock: "AAPL",
ReleaseTime: timeSinceMidnight,
Qualifier: QUALIFIER_ANTICIPATED,
Price: 21,
Expand All @@ -35,8 +34,7 @@ func TestMakeAndParseIpoQuotation(t *testing.T) {
t.Errorf("error parsing event: %v", err)
}

// Ignoring Stock field because the byte representation contains right-padded spacing, whilst the Struct has it trimmed
if !cmp.Equal(m, parsedEvent, cmpopts.IgnoreFields(IpoQuotation{}, "Stock")) {
if !cmp.Equal(m, parsedEvent) {
t.Errorf("parsed event and original event are not equal:\n%v", cmp.Diff(m, parsedEvent))
}
}

0 comments on commit 7c88359

Please sign in to comment.