From abec5d26514e866450c7cb30021e1c2efa03d043 Mon Sep 17 00:00:00 2001 From: Zorchenhimer Date: Sat, 13 Feb 2021 20:23:48 -0500 Subject: [PATCH] Added verb conjugation tests --- models/verb_test.go | 118 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 models/verb_test.go diff --git a/models/verb_test.go b/models/verb_test.go new file mode 100644 index 0000000..c80ed21 --- /dev/null +++ b/models/verb_test.go @@ -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) + } + } +}