Sha256: fdacbd6f8db6fc89d0637da35abb667e673a45de0c388e828431b06886265c17

Contents?: true

Size: 994 Bytes

Versions: 122

Compression:

Stored size: 994 Bytes

Contents

package variablelengthquantity

import (
	"bytes"
	"reflect"
	"testing"
)

func TestDecodeVarint(t *testing.T) {
	for i, tc := range decodeTestCases {
		o, err := DecodeVarint(tc.input)
		if err != nil {
			var _ error = err
			if tc.output != nil {
				t.Fatalf("FAIL: case %d | %s\nexpected %#v got error: %q\n", i, tc.description, tc.output, err)
			}
		} else if tc.output == nil {
			t.Fatalf("FAIL: case %d | %s\nexpected error, got %#v\n", i, tc.description, o)
		} else if !reflect.DeepEqual(o, tc.output) {
			t.Fatalf("FAIL: case %d | %s\nexpected\t%#v\ngot\t\t%#v\n", i, tc.description, tc.output, o)
		}
		t.Logf("PASS: case %d | %s\n", i, tc.description)
	}
}

func TestEncodeVarint(t *testing.T) {
	for i, tc := range encodeTestCases {
		if encoded := EncodeVarint(tc.input); bytes.Compare(encoded, tc.output) != 0 {
			t.Fatalf("FAIL: case %d | %s\nexpected\t%#v\ngot\t\t%#v\n", i, tc.description, tc.output, encoded)
		}
		t.Logf("PASS: case %d | %s\n", i, tc.description)
	}
}

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.179 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.178 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.177 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.176 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.175 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.174 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.173 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.172 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.171 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.170 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.169 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.167 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.166 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.165 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.164 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.163 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.162 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.161 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go
trackler-2.2.1.160 tracks/go/exercises/variable-length-quantity/variable_length_quantity_test.go