46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package logic
|
|
|
|
import "testing"
|
|
|
|
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"
|
|
|
|
description := GetBinderLocationDescription(position)
|
|
|
|
assert(t, description, expected)
|
|
}
|
|
|
|
func Test_GetBinderLocationDescription_ReturnsCorrectSlotNumber_ForFirstSlotOnBackOfPage(t *testing.T) {
|
|
var position int = 10
|
|
var expected string = " on page 1 in back slot 1"
|
|
|
|
description := GetBinderLocationDescription(position)
|
|
|
|
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)
|
|
}
|