aboutsummaryrefslogtreecommitdiff
path: root/challenge-120/lance-wicks/golang/clocks/clock_test.go
blob: a846ca4afc01358cabb132eb2cfe14c304ac1f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestAngle(t *testing.T) {
	assert.Equal(t, float64(35), angle("03:10"), "Example 1")
	assert.Equal(t, float64(120), angle("04:00"), "Example 2")
}

func TestHoursAngle(t *testing.T) {
	expect := float64(((3 * 60) + 10) * .5)
	got := hourAngle("03", "10")
	assert.Equal(t, expect, got, "Example 1")
}

func TestMinuteAngle(t *testing.T) {
	expect := float64(6 * 10)
	got := minuteAngle("03", "10")
	assert.Equal(t, expect, got, "Example 1")
}