Slide 15
Slide 15 text
15
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
௨ৗͷςετ
import "testing"
func TestAdd(t *testing.T) {
tests := []struct {
x int
y int
want int
}{
{x: 0, y: 1, want: 1}, // 0 + 1 = 1
{x: 1, y: 1, want: 2}, // 1 + 1 = 2
}
for _, tt := range tests {
if got := Add(tt.x, tt.y); got != tt.want {
t.Errorf("Add() = %v, want %v", got, tt.want)
}
}
}