tests to make sure symmetric operations are supported for arrays...
(t *testing.T)
| 925 | |
| 926 | // tests to make sure symmetric operations are supported for arrays... |
| 927 | func TestSpansetOperationEvaluateArraySymmetric(t *testing.T) { |
| 928 | testCases := []evalTC{ |
| 929 | // string arrays |
| 930 | { |
| 931 | "{ `bar` = .foo }", // Symmetric match for string array |
| 932 | []*Spanset{ |
| 933 | {Spans: []Span{ |
| 934 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticStringArray([]string{"bar", "baz"})}}, |
| 935 | }}, |
| 936 | }, |
| 937 | []*Spanset{ |
| 938 | {Spans: []Span{ |
| 939 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticStringArray([]string{"bar", "baz"})}}, |
| 940 | }}, |
| 941 | }, |
| 942 | }, |
| 943 | { |
| 944 | "{ `baz` != .foo }", // Symmetric string not in array |
| 945 | []*Spanset{ |
| 946 | {Spans: []Span{ |
| 947 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticStringArray([]string{"bar", "bat"})}}, |
| 948 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticStringArray([]string{"baz"})}}, |
| 949 | }}, |
| 950 | }, |
| 951 | []*Spanset{ |
| 952 | {Spans: []Span{ |
| 953 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticStringArray([]string{"bar", "bat"})}}, |
| 954 | }}, |
| 955 | }, |
| 956 | }, |
| 957 | // int arrays |
| 958 | { |
| 959 | "{ 2 = .foo }", // Symmetric match for int array |
| 960 | []*Spanset{ |
| 961 | {Spans: []Span{ |
| 962 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{1, 2})}}, |
| 963 | }}, |
| 964 | }, |
| 965 | []*Spanset{ |
| 966 | {Spans: []Span{ |
| 967 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{1, 2})}}, |
| 968 | }}, |
| 969 | }, |
| 970 | }, |
| 971 | { |
| 972 | "{ 3 != .foo }", // Symmetric not equal for int array |
| 973 | []*Spanset{ |
| 974 | {Spans: []Span{ |
| 975 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{1, 2})}}, |
| 976 | &mockSpan{id: []byte{2}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{3, 4})}}, |
| 977 | &mockSpan{id: []byte{3}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{3})}}, |
| 978 | }}, |
| 979 | }, |
| 980 | []*Spanset{ |
| 981 | {Spans: []Span{ |
| 982 | &mockSpan{id: []byte{1}, attributes: map[Attribute]Static{NewAttribute("foo"): NewStaticIntArray([]int{1, 2})}}, |
| 983 | }}, |
| 984 | }, |
nothing calls this directly
no test coverage detected