sum: use DeepEqual to compare
This commit is contained in:
		@ -1,7 +1,7 @@
 | 
				
			|||||||
package sum
 | 
					package sum
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"slices"
 | 
						"reflect"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -21,7 +21,9 @@ func TestSum(t *testing.T) {
 | 
				
			|||||||
func TestSumAll(t *testing.T) {
 | 
					func TestSumAll(t *testing.T) {
 | 
				
			||||||
	got := SumAll([]int{1, 2}, []int{0, 9})
 | 
						got := SumAll([]int{1, 2}, []int{0, 9})
 | 
				
			||||||
	exp := []int{3, 9}
 | 
						exp := []int{3, 9}
 | 
				
			||||||
	if slices.Compare(got, exp) != 0 {
 | 
					
 | 
				
			||||||
 | 
						// NOTE: check if any two variables are the same
 | 
				
			||||||
 | 
						if !reflect.DeepEqual(got, exp) {
 | 
				
			||||||
		t.Errorf("got %d, expected %d", got, exp)
 | 
							t.Errorf("got %d, expected %d", got, exp)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user