summaryrefslogtreecommitdiff
path: root/main_test.go
blob: 51002d7dcf9f6f2d8253189518154596b30fd6be (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
package main

import "testing"

func TestNoSpaceCompare(t *testing.T) {
	testCases := []struct {
		a, b string
		ok   bool
	}{
		{"", "", true},
		{"x", "", false},
		{"", "x", false},
		{"x ", "x", true},
		{" x", "x", true},
		{"x x", "xx", true},
		{"x x x", "x", false},
	}
	for _, tc := range testCases {
		t.Run(tc.a+"?"+tc.b, func(t *testing.T) {
			ok := noSpaceCompare(tc.a, tc.b)
			if ok != tc.ok {
				t.Errorf("got %v; want %v", ok, tc.ok)
			}
		})
	}
}