func TestAddition(t *testing.T) { result := Add(2, 3) if result != 5 { t.Errorf("Expected 5, but got %d", result) } }
func TestParallelAddition(t *testing.T) { t.Parallel() result := Add(2, 3) if result != 5 { t.Errorf("Expected 5, but got %d", result) } } func TestParallelMultiplication(t *testing.T) { t.Parallel() result := Multiply(2, 3) if result != 6 { t.Errorf("Expected 6, but got %d", result) } }
func TestAddition(t *testing.T) { t.Run("positive numbers", func(t *testing.T) { result := Add(2, 3) if result != 5 { t.Errorf("Expected 5, but got %d", result) } }) t.Run("negative numbers", func(t *testing.T) { result := Add(-2, -3) if result != -5 { t.Errorf("Expected -5, but got %d", result) } }) }Overall, the go github.com.pingcap.check package provides a robust and scalable testing framework for Go developers to write quality and reliable code.