package Solution

import (
	"reflect"
	"strconv"
	"testing"
)

func TestSolution(t *testing.T) {
	//	测试用例
	cases := []struct {
		name                                 string
		restaurants                          [][]int
		veganFriendly, maxPrice, maxDistance int
		expect                               []int
	}{
		{"TestCase1", [][]int{
			{1, 4, 1, 40, 10}, {2, 8, 0, 50, 5}, {3, 8, 1, 30, 4}, {4, 10, 0, 10, 3}, {5, 1, 1, 15, 1},
		}, 1, 50, 10, []int{3, 1, 5}},
		{"TestCase2", [][]int{
			{1, 4, 1, 40, 10}, {2, 8, 0, 50, 5}, {3, 8, 1, 30, 4}, {4, 10, 0, 10, 3}, {5, 1, 1, 15, 1},
		}, 0, 50, 10, []int{4, 3, 2, 1, 5}},
		{"TestCase3", [][]int{
			{1, 4, 1, 40, 10}, {2, 8, 0, 50, 5}, {3, 8, 1, 30, 4}, {4, 10, 0, 10, 3}, {5, 1, 1, 15, 1},
		}, 0, 30, 3, []int{4, 5}},
	}

	//	开始测试
	for i, c := range cases {
		t.Run(c.name+" "+strconv.Itoa(i), func(t *testing.T) {
			got := Solution(c.restaurants, c.veganFriendly, c.maxPrice, c.maxDistance)
			if !reflect.DeepEqual(got, c.expect) {
				t.Fatalf("expected: %v, but got: %v, with inputs: %v %v %v %v",
					c.expect, got, c.restaurants, c.veganFriendly, c.maxPrice, c.maxDistance)
			}
		})
	}
}

// 压力测试
func BenchmarkSolution(b *testing.B) {
}

// 使用案列
func ExampleSolution() {
}
