mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
package main |
|
|
|
import ( |
|
"testing" |
|
|
|
"github.com/01-edu/z01" |
|
|
|
solutions "../../solutions" // This line is not necessary when testing an exercise with a program |
|
) |
|
|
|
func TestIsAnagram(t *testing.T) { |
|
type node struct { |
|
s string |
|
t string |
|
} |
|
|
|
table := []node{} |
|
|
|
table = append(table, |
|
node{"listen", "silent"}, |
|
node{"alem", "school"}, |
|
node{"neat", "a net"}, |
|
node{"anna madrigal", "a man and a girl"}, |
|
node{"abcc", "abcd"}, |
|
node{"aaaac", "caaaa"}, |
|
node{"", ""}, |
|
node{" ", ""}, |
|
node{"lyam", "meow"}, |
|
node{"golang", "lang go"}, |
|
node{"verylongword", "v e r y l o n g w o r d"}, |
|
node{"chess", "ches"}, |
|
node{"anagram", "nnagram"}, |
|
node{"chess", "board"}, |
|
node{"mmm", "m"}, |
|
node{"pulp", "fiction"}, |
|
) |
|
|
|
for i := 0; i < 15; i++ { |
|
value := node { |
|
s: z01.RandStr(z01.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), |
|
t: z01.RandStr(z01.RandIntBetween(15, 20), "qwertyuiopasdfghjklzxcvbnm "), |
|
} |
|
|
|
table = append(table, value) |
|
} |
|
|
|
for _, arg := range(table) { |
|
z01.Challenge(t, IsAnagram, solutions.IsAnagram, arg.s, arg.t) |
|
} |
|
} |