aboutsummaryrefslogtreecommitdiff
path: root/bot/bot_test.go
blob: 122614fdb78f60951078592c98123e027546fc5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package bot

import "testing"

func TestPhraseString(t *testing.T) {
  passTests := []struct {
    val Phrase // test value
    exp string // expected string
  } {{
    val: Phrase {
      Verb: 0,
      Noun: 0,
    },
    exp: "actualize action items",
  }, {
    val: Phrase {
      HasAdverb: true,
      Adverb: 1,
      Verb: 2,
      Noun: 3,
    },
    exp: "assertively aggregate architectures",
  }, {
    val: Phrase {
      HasAdverb: true,
      Adverb: 2,
      Verb: 3,
      Adjectives: []int { 4 },
      Noun: 5,
    },
    exp: "authoritatively architect alternative benefits",
  }, {
    val: Phrase {
      HasAdverb: true,
      Adverb: 3,
      Verb: 4,
      Adjectives: []int { 5, 6 },
      Noun: 7,
    },
    exp: "collaboratively benchmark an expanded array of and B2B catalysts for change",
  }, {
    val: Phrase {
      HasAdverb: true,
      Adverb: 4,
      Verb: 5,
      Adjectives: []int { 6, 7, 8 },
      Noun: 9,
    },
    exp: "compellingly brand B2B, B2C, and backend clouds",
  }}

  for _, test := range(passTests) {
    t.Run(test.exp, func(t *testing.T) {
      got := test.val.String()
      if got != test.exp {
        t.Fatalf("got \"%s\", exp \"%s\"", got, test.exp)
      }
    })
  }
}

func TestSentenceString(t *testing.T) {
  passTests := []struct {
    val Sentence // test value
    exp string // expected string
  } {{
    val: Sentence{
      Phrases: []Phrase{
        Phrase {
          Verb: 0,
          Noun: 0,
        },
      },
    },
    exp: "actualize action items",
  }, {
    val: Sentence {
      Phrases: []Phrase {
        Phrase {
          Verb: 0,
          Noun: 0,
        },

        Phrase {
          HasAdverb: true,
          Adverb: 1,
          Verb: 2,
          Noun: 3,
        },
      },
      Joins: []int { 0 },
    },
    exp: "actualize action items for assertively aggregate architectures",
  }}

  for _, test := range(passTests) {
    t.Run(test.exp, func(t *testing.T) {
      got := test.val.String()
      if got != test.exp {
        t.Fatalf("got \"%s\", exp \"%s\"", got, test.exp)
      }
    })
  }
}