Added verb conjugation tests

This commit is contained in:
Zorchenhimer 2021-02-13 20:23:48 -05:00
parent 64b7ce434f
commit abec5d2651
Signed by: Zorchenhimer
GPG Key ID: 70A1AB767AAB9C20
1 changed files with 118 additions and 0 deletions

118
models/verb_test.go Normal file
View File

@ -0,0 +1,118 @@
package models
import (
"testing"
)
type verbTestCase struct {
Word Verb
Past string
Future string
Present_It string
Present_You string
}
var verbtestdata []verbTestCase = []verbTestCase{
verbTestCase{
Word: Verb{
Regular: true,
Word: "pull",
},
Past: "pulled",
Future: "will pull",
Present_It: "pulls",
Present_You: "pull",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "push",
},
Past: "pushed",
Future: "will push",
Present_It: "pushes",
Present_You: "push",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "clone",
},
Past: "cloned",
Future: "will clone",
Present_It: "clones",
Present_You: "clone",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "identify",
},
Past: "identified",
Future: "will identify",
Present_It: "identifies",
Present_You: "identify",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "fetch",
},
Past: "fetched",
Future: "will fetch",
Present_It: "fetches",
Present_You: "fetch",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "access",
},
Past: "accessed",
Future: "will access",
Present_It: "accesses",
Present_You: "access",
},
verbTestCase{
Word: Verb{
Regular: true,
Word: "index",
},
Past: "indexed",
Future: "will index",
Present_It: "indexes",
Present_You: "index",
},
}
func Test_Verbs(t *testing.T) {
for _, td := range verbtestdata {
past := td.Word.Conjugate(CT_It, CM_Past, false)
presentIt := td.Word.Conjugate(CT_It, CM_Present, false)
presentYou := td.Word.Conjugate(CT_You, CM_Present, false)
future := td.Word.Conjugate(CT_It, CM_Future, false)
if past != td.Past {
t.Errorf("past failed: %s != %s", past, td.Past)
}
if presentIt != td.Present_It {
t.Errorf("presentIt failed: %s != %s", presentIt, td.Present_It)
}
if presentYou != td.Present_You {
t.Errorf("presentYou failed: %s != %s", presentYou, td.Present_You)
}
if future != td.Future {
t.Errorf("future failed: %s != %s", future, td.Future)
}
}
}