MCPcopy Create free account
hub / github.com/OpenPrinting/goipp / TestValueType

Function TestValueType

value_test.go:679–709  ·  view source on GitHub ↗

TestValueType rests Value.Type method for various kinds of the Value

(t *testing.T)

Source from the content-addressed store, hash-verified

677// TestValueType rests Value.Type method for various
678// kinds of the Value
679func TestValueType(t *testing.T) {
680 type testData struct {
681 v Value // Input value
682 tp Type // Expected output type
683 }
684
685 tests := []testData{
686 {Binary(nil), TypeBinary},
687 {Boolean(false), TypeBoolean},
688 {Collection(nil), TypeCollection},
689 {Integer(0), TypeInteger},
690 {Range{}, TypeRange},
691 {Resolution{}, TypeResolution},
692 {String(""), TypeString},
693 {TextWithLang{}, TypeTextWithLang},
694 {Time{time.Time{}}, TypeDateTime},
695 {Void{}, TypeVoid},
696 }
697
698 for _, test := range tests {
699 tp := test.v.Type()
700 if tp != test.tp {
701 t.Errorf("testing %s.Type:\n"+
702 "expected: %q\n"+
703 "present: %q\n",
704 reflect.TypeOf(test.v).String(),
705 test.tp, tp,
706 )
707 }
708 }
709}
710
711// TestValueEqualSimilar tests ValueEqual and ValueSimilar
712func TestValueEqualSimilar(t *testing.T) {

Callers

nothing calls this directly

Calls 7

BinaryTypeAlias · 0.85
BooleanTypeAlias · 0.85
CollectionTypeAlias · 0.85
IntegerTypeAlias · 0.85
StringTypeAlias · 0.85
TypeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected