Skip to content

Instantly share code, notes, and snippets.

@mattford63
Created February 23, 2024 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattford63/1140c4dac1b93299e77329f9b62650dc to your computer and use it in GitHub Desktop.
Save mattford63/1140c4dac1b93299e77329f9b62650dc to your computer and use it in GitHub Desktop.
test
package main
import (
"strings"
"testing"
)
func TestReverse(t *testing.T) {
if reverse("abc") != "cba" {
t.Fatalf("Reverse doesn't work")
}
}
func TestExample(t *testing.T) {
example := `1abc2
apqr3stu8vwx
a1b2c3d4e5f
treb7uchet`
exampleLines := strings.Split(example, "\n")
result := calibration(exampleLines)
if result != 142 {
t.Fatal("Expected result is", result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment