-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
38 lines (33 loc) · 927 Bytes
/
main_test.go
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
package main
import (
"strconv"
"testing"
"github.com/stretchr/testify/assert"
"github.com/marktwtn/steam-wishlists-combination-generator/crawler"
)
func Test_is_budget_valid(t *testing.T) {
test_data := []struct {
lower_bound int
upper_bound int
expected bool
}{
{0, 500, true},
{500, 0, false},
{500, 500, true},
{-10, 500, false},
{0, -500, false},
}
for _, data := range test_data {
var result = is_budget_valid(data.lower_bound, data.upper_bound)
if result != data.expected {
assert.Equalf(t, data.expected, result, "The result should be %t instead of %t.", result, data.expected)
}
}
}
func Test_generate_filtered_combination(t *testing.T) {
test_data := []crawler.Wishitem{}
for idx := 0; idx < 10; idx++ {
test_data = append(test_data, crawler.New_wishitem(uint(idx), strconv.Itoa(idx), 50, 80))
}
generate_filtered_combination(7, 1000, test_data, make(chan int, 100))
}