TheMathemagicians/sevenkeys/logic/locate_test.go

46 lines
1.3 KiB
Go
Raw Normal View History

2024-09-07 23:24:24 +00:00
package logic
import "testing"
2024-09-17 10:25:51 +00:00
func assert(t *testing.T, description string, expected string) {
if description != expected {
t.Errorf("expected \"%s\", got \"%s\"\n", expected, description)
}
}
func Test_GetBinderLocationDescription_ReturnsCorrectSlotNumber_ForFirstSlotInPage(t *testing.T) {
var position int = 1
var expected string = " on page 1 in front slot 1"
2024-09-07 23:24:24 +00:00
description := GetBinderLocationDescription(position)
2024-09-17 10:25:51 +00:00
assert(t, description, expected)
2024-09-07 23:24:24 +00:00
}
2024-09-17 10:25:51 +00:00
func Test_GetBinderLocationDescription_ReturnsCorrectSlotNumber_ForFirstSlotOnBackOfPage(t *testing.T) {
var position int = 10
var expected string = " on page 1 in back slot 1"
2024-09-07 23:24:24 +00:00
description := GetBinderLocationDescription(position)
2024-09-17 10:25:51 +00:00
assert(t, description, expected)
}
func Test_GetBinderLocationDescription_ReturnsCorrectSlotNumber_ForLastSlotOnBackOfPage(t *testing.T) {
var position int = 18
var expected string = " on page 1 in back slot 9"
description := GetBinderLocationDescription(position)
assert(t, description, expected)
}
func Test_GetBinderLocationDescription_ReturnsCorrectSlotNumber_ForLastSlotOnBackOfSecondPage(t *testing.T) {
var position int = 36
var expected string = " on page 2 in back slot 9"
description := GetBinderLocationDescription(position)
assert(t, description, expected)
2024-09-07 23:24:24 +00:00
}