MCPcopy Create free account
hub / github.com/blevesearch/bleve / TestMappingPrimitives

Function TestMappingPrimitives

mapping/mapping_test.go:819–851  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

817}
818
819func TestMappingPrimitives(t *testing.T) {
820
821 tests := []struct {
822 data interface{}
823 }{
824 {data: "marty"},
825 {data: int(1)},
826 {data: int8(2)},
827 {data: int16(3)},
828 {data: int32(4)},
829 {data: int64(5)},
830 {data: uint(6)},
831 {data: uint8(7)},
832 {data: uint16(8)},
833 {data: uint32(9)},
834 {data: uint64(10)},
835 {data: float32(11.0)},
836 {data: float64(12.0)},
837 {data: false},
838 }
839
840 m := NewIndexMapping()
841 for _, test := range tests {
842 doc := document.NewDocument("x")
843 err := m.MapDocument(doc, test.data)
844 if err != nil {
845 t.Fatal(err)
846 }
847 if len(doc.Fields) != 1 {
848 t.Errorf("expected 1 field, got %d for %v", len(doc.Fields), test.data)
849 }
850 }
851}
852
853func TestMappingForGeo(t *testing.T) {
854

Callers

nothing calls this directly

Calls 3

MapDocumentMethod · 0.95
NewDocumentFunction · 0.92
NewIndexMappingFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…