(t *testing.T)
| 638 | } |
| 639 | |
| 640 | func TestStatic_append(t *testing.T) { |
| 641 | tests := []struct { |
| 642 | s1, s2, want Static |
| 643 | }{ |
| 644 | // int |
| 645 | {s1: NewStaticInt(1), s2: NewStaticInt(2), want: NewStaticIntArray([]int{1, 2})}, |
| 646 | {s1: NewStaticInt(1), s2: NewStaticIntArray([]int{2, 3}), want: NewStaticIntArray([]int{1, 2, 3})}, |
| 647 | {s1: NewStaticIntArray([]int{1, 2}), s2: NewStaticInt(3), want: NewStaticIntArray([]int{1, 2, 3})}, |
| 648 | {s1: NewStaticIntArray([]int{1, 2}), s2: NewStaticIntArray([]int{3, 4}), want: NewStaticIntArray([]int{1, 2, 3, 4})}, |
| 649 | {s1: NewStaticIntArray([]int{1, 2}), s2: NewStaticDuration(1 * time.Second), want: NewStaticNil()}, |
| 650 | {s1: NewStaticIntArray([]int{1, 2}), s2: NewStaticString("1"), want: NewStaticNil()}, |
| 651 | // float |
| 652 | {s1: NewStaticFloat(1.1), s2: NewStaticFloat(2.2), want: NewStaticFloatArray([]float64{1.1, 2.2})}, |
| 653 | {s1: NewStaticFloat(1.1), s2: NewStaticFloatArray([]float64{2.2, 3.3}), want: NewStaticFloatArray([]float64{1.1, 2.2, 3.3})}, |
| 654 | {s1: NewStaticFloatArray([]float64{1.1, 2.2}), s2: NewStaticFloat(3.3), want: NewStaticFloatArray([]float64{1.1, 2.2, 3.3})}, |
| 655 | {s1: NewStaticFloatArray([]float64{1.1, 2.2}), s2: NewStaticFloatArray([]float64{3.3, 4.4}), want: NewStaticFloatArray([]float64{1.1, 2.2, 3.3, 4.4})}, |
| 656 | {s1: NewStaticFloatArray([]float64{1.1, 2.2}), s2: NewStaticDuration(1 * time.Second), want: NewStaticNil()}, |
| 657 | {s1: NewStaticFloatArray([]float64{1.1, 2.2}), s2: NewStaticString("1.1"), want: NewStaticNil()}, |
| 658 | // string |
| 659 | {s1: NewStaticString("1"), s2: NewStaticString("2"), want: NewStaticStringArray([]string{"1", "2"})}, |
| 660 | {s1: NewStaticString("1"), s2: NewStaticStringArray([]string{"2", "3"}), want: NewStaticStringArray([]string{"1", "2", "3"})}, |
| 661 | {s1: NewStaticStringArray([]string{"1", "2"}), s2: NewStaticString("3"), want: NewStaticStringArray([]string{"1", "2", "3"})}, |
| 662 | {s1: NewStaticStringArray([]string{"1", "2"}), s2: NewStaticStringArray([]string{"3", "4"}), want: NewStaticStringArray([]string{"1", "2", "3", "4"})}, |
| 663 | {s1: NewStaticStringArray([]string{"1", "2"}), s2: NewStaticInt(1), want: NewStaticNil()}, |
| 664 | // bool |
| 665 | {s1: NewStaticBool(true), s2: NewStaticBool(false), want: NewStaticBooleanArray([]bool{true, false})}, |
| 666 | {s1: NewStaticBool(true), s2: NewStaticBooleanArray([]bool{false, true}), want: NewStaticBooleanArray([]bool{true, false, true})}, |
| 667 | {s1: NewStaticBooleanArray([]bool{true, false}), s2: NewStaticBool(true), want: NewStaticBooleanArray([]bool{true, false, true})}, |
| 668 | {s1: NewStaticBooleanArray([]bool{true, false}), s2: NewStaticBooleanArray([]bool{true, false}), want: NewStaticBooleanArray([]bool{true, false, true, false})}, |
| 669 | {s1: NewStaticBooleanArray([]bool{true, false}), s2: NewStaticInt(1), want: NewStaticNil()}, |
| 670 | } |
| 671 | for _, tt := range tests { |
| 672 | res, ok := tt.s1.append(tt.s2) |
| 673 | assert.Equal(t, tt.want, res) |
| 674 | if res.IsNil() { |
| 675 | assert.False(t, ok) |
| 676 | } |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | func TestPipelineExtractConditions(t *testing.T) { |
| 681 | testCases := []struct { |
nothing calls this directly
no test coverage detected