Rework every uint8 to byte and rework every []byte to bytes.Buffer
I just learnt that uint8 and byte are the fucking same And that bytes.Buffer is the thing to use Idiot idiot idiot... Live and learn
This commit is contained in:
		@@ -14,7 +14,7 @@ func TestCalculateSizeTypicalInstance(t *testing.T) {
 | 
			
		||||
		validity_period:        "",
 | 
			
		||||
		short_message:          "Hello, World!",
 | 
			
		||||
	}
 | 
			
		||||
	expectedSize := uint32(16 + len(p.service_type) + 1 + 1 + len(p.source_addr) + 1 + 1 + len(p.destination_addr) + 1 + 1 + 1 + len(p.schedule_delivery_time) + len(p.validity_period) + 1 + 1 + 1 + 1 + 1 + len(p.short_message))
 | 
			
		||||
	expectedSize := 16 + len(p.service_type) + 1 + 1 + len(p.source_addr) + 1 + 1 + len(p.destination_addr) + 1 + 1 + 1 + len(p.schedule_delivery_time) + len(p.validity_period) + 1 + 1 + 1 + 1 + 1 + len(p.short_message)
 | 
			
		||||
	actualSize := p.Size()
 | 
			
		||||
	if actualSize != expectedSize {
 | 
			
		||||
		t.Errorf("Expected size %d, but got %d", expectedSize, actualSize)
 | 
			
		||||
@@ -31,7 +31,7 @@ func TestCalculateSizeMaxLengths(t *testing.T) {
 | 
			
		||||
		validity_period:        string(make([]byte, maxLen)),
 | 
			
		||||
		short_message:          string(make([]byte, maxLen)),
 | 
			
		||||
	}
 | 
			
		||||
	expectedSize := uint32(16 + maxLen + 1 + 1 + maxLen + 1 + 1 + maxLen + 1 + 1 + 1 + maxLen + maxLen + 1 + 1 + 1 + 1 + 1 + maxLen)
 | 
			
		||||
	expectedSize := 16 + maxLen + 1 + 1 + maxLen + 1 + 1 + maxLen + 1 + 1 + 1 + maxLen + maxLen + 1 + 1 + 1 + 1 + 1 + maxLen
 | 
			
		||||
	actualSize := p.Size()
 | 
			
		||||
	if actualSize != expectedSize {
 | 
			
		||||
		t.Errorf("Expected size %d, but got %d", expectedSize, actualSize)
 | 
			
		||||
@@ -47,7 +47,7 @@ func TestHandlesEmptyStringsForAllStringFields(t *testing.T) {
 | 
			
		||||
		validity_period:        "",
 | 
			
		||||
		short_message:          "",
 | 
			
		||||
	}
 | 
			
		||||
	expectedSize := uint32(16 + len(p.service_type) + 1 + 1 + len(p.source_addr) + 1 + 1 + len(p.destination_addr) + 1 + 1 + 1 + len(p.schedule_delivery_time) + len(p.validity_period) + 1 + 1 + 1 + 1 + 1 + len(p.short_message))
 | 
			
		||||
	expectedSize := 16 + len(p.service_type) + 1 + 1 + len(p.source_addr) + 1 + 1 + len(p.destination_addr) + 1 + 1 + 1 + len(p.schedule_delivery_time) + len(p.validity_period) + 1 + 1 + 1 + 1 + 1 + len(p.short_message)
 | 
			
		||||
	actualSize := p.Size()
 | 
			
		||||
	if actualSize != expectedSize {
 | 
			
		||||
		t.Errorf("Expected size %d, but got %d", expectedSize, actualSize)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user