Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Created September 5, 2021 15:32
Show Gist options
  • Select an option

  • Save agusrichard/6c6c196274947b70c296a0ba7330c7d8 to your computer and use it in GitHub Desktop.

Select an option

Save agusrichard/6c6c196274947b70c296a0ba7330c7d8 to your computer and use it in GitHub Desktop.
package main
import "testing"
func TestDoubleMe(t *testing.T) {
table := []struct {
input float64
expected float64
}{
{1, 2},
{-1, -2},
{0, 0},
{-100, -200},
{100, 200},
}
for _, test := range table {
result := doubleMe(test.input)
if result != test.expected {
t.Errorf("doubleMe(%f) = %f, expected %f", test.input, result, test.expected)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment