name
stringlengths
15
44
language
stringclasses
1 value
prompt
stringlengths
142
837
doctests
stringclasses
1 value
original
stringlengths
130
159
prompt_terminology
stringclasses
1 value
tests
stringlengths
489
2.6k
stop_tokens
listlengths
3
3
HumanEval_106_f
go_test.go
package f_test import ( "testing" "fmt" ) // iは1から始まる。iの階乗は1からiまでの数の掛け算(1 * 2 * ... * i)である。 // 例: // >>> f(5) // []int{1, 2, 6, 24, 15} func f(n int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
reworded
func TestF(t *testing.T) { candidate := f type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(5), expected: []int{1, 2, 6, 24, 15} }, { actual: candidate(7), expected: []int{1, 2, 6, 24, 15, 720, 28} }, { actual: candidate(1), expected: []int{1} }, { actual: candidate(3), expected: []int{1, 2, 6} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_107_even_odd_palindrome
go_test.go
package even_odd_palindrome_test import ( "testing" "fmt" ) // 与えられた正の整数 nに対して、範囲 1 から n まで(両端を含む)に存在する // 偶数の回文数(integer palindrome)と奇数の回文数の個数をタプル形式で返す。 // 例 1: // >>> even_odd_palindrome(3) // []interface{}{1, 2} // 解説: // 回文数は1、2、3であり、そのうち1つは偶数、2つは奇数である。 // 例 2: // >>> even_odd_palindrome(12) // []interface{}{4, 6} // 解説: // 回文数は、1、2、3、4、5、6、7、8、9、11であり、そのうち4つは偶数、6つは奇数である。 // ノート: // 1. 1 <= n <= 10^3 // 2. 返されるタプルは、それぞれ偶数と奇数の回文数を持つ。 func even_odd_palindrome(n int) []interface{} {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
reworded
func TestEven_Odd_Palindrome(t *testing.T) { candidate := even_odd_palindrome type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(123), expected: []interface{}{8, 13} }, { actual: candidate(12), expected: []interface{}{4, 6} }, { actual: candidate(3), expected: []interface{}{1, 2} }, { actual: candidate(63), expected: []interface{}{6, 8} }, { actual: candidate(25), expected: []interface{}{5, 6} }, { actual: candidate(19), expected: []interface{}{4, 6} }, { actual: candidate(9), expected: []interface{}{4, 5} }, { actual: candidate(1), expected: []interface{}{0, 1} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_108_count_nums
go_test.go
package count_nums_test import ( "testing" "fmt" ) // count_nums 関数は、整数の配列を引数として受け取り、その配列内の各整数の各桁の合計が // >0 となるような整数の個数を返す。負の数に関しては、最初の桁(符号付き桁)は負となる。 // たとえば、−123 の符号付き桁は −1, 2, 3 である。 // >>> count_nums([]int{}) // 0 // >>> count_nums([]int{-1, 11, -11}) // 1 // >>> count_nums([]int{1, 1, 2}) // 3 func count_nums(arr []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
reworded
func TestCount_Nums(t *testing.T) { candidate := count_nums type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{}), expected: 0 }, { actual: candidate([]int{-1, -2, 0}), expected: 0 }, { actual: candidate([]int{1, 1, 2, -2, 3, 4, 5}), expected: 6 }, { actual: candidate([]int{1, 6, 9, -6, 0, 1, 5}), expected: 5 }, { actual: candidate([]int{1, 100, 98, -7, 1, -1}), expected: 4 }, { actual: candidate([]int{12, 23, 34, -45, -56, 0}), expected: 5 }, { actual: candidate([]int{0, 1}), expected: 1 }, { actual: candidate([]int{1}), expected: 1 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_109_move_one_ball
go_test.go
package move_one_ball_test import ( "testing" "fmt" ) // N個の整数arr[1], arr[2], ..., arr[N]なる配列 'arr' があります。 // この配列の数字はランダムな順番に並んでいます。あなたの課題は、以下の操作を何度でも行うことで、 // 配列を非減少の順番にソートできるかどうかを判断することです。 // 操作として許されているのは「右シフト」です。 // 一回の「右シフト」操作とは、配列のすべての要素を右方向に一つずつずらすことを意味します。 // 配列の最後の要素は配列の先頭、すなわち0番目のインデックスに移動します。 // 上記の操作を行ってソートされた配列を得られる場合は true を、そうでない場合は false を返してください。 // 与えられた配列が空の場合は true を返してください。 // 注意:与えられたリストには一意の要素しか含まれていないことが保証されています。 // 例: // >>> move_one_ball([]int{3, 4, 5, 1, 2}) // true // 説明:2回の右シフト操作を行うことで、与えられた配列を非減少の順序にすることができます。 // >>> move_one_ball([]int{3, 5, 4, 1, 2}) // false // 説明:どれだけ右シフト操作を行っても、与えられた配列を非減少の順序にすることはできません。 func move_one_ball(arr []int) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
reworded
func TestMove_One_Ball(t *testing.T) { candidate := move_one_ball type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{3, 4, 5, 1, 2}), expected: true }, { actual: candidate([]int{3, 5, 10, 1, 2}), expected: true }, { actual: candidate([]int{4, 3, 1, 2}), expected: false }, { actual: candidate([]int{3, 5, 4, 1, 2}), expected: false }, { actual: candidate([]int{}), expected: true }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_110_exchange
go_test.go
package exchange_test import ( "testing" "fmt" ) // この問題では、2つの数のリストを受け取り、lst1を偶数のみのリストに // するために、それらの間で要素の交換を行うことが可能かどうかを判断す // る関数を実装する。 // lst1とlst2の間で交換される要素の数に制限はない。 // lst1とlst2の間で要素の交換を行い、lst1の要素をすべて偶数にすることが // 可能であれば、"YES "を返す。 // そうでなければ "NO "を返す。 // 例えば: // >>> exchange([]int{1, 2, 3, 4}, []int{1, 2, 3, 4}) // "YES" // >>> exchange([]int{1, 2, 3, 4}, []int{1, 5, 3, 4}) // "NO" // 受け取るリストは空でないと前提してよい。 func exchange(lst1 []int, lst2 []int) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
reworded
func TestExchange(t *testing.T) { candidate := exchange type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 2, 3, 4}, []int{1, 2, 3, 4}), expected: "YES" }, { actual: candidate([]int{1, 2, 3, 4}, []int{1, 5, 3, 4}), expected: "NO" }, { actual: candidate([]int{1, 2, 3, 4}, []int{2, 1, 4, 3}), expected: "YES" }, { actual: candidate([]int{5, 7, 3}, []int{2, 6, 4}), expected: "YES" }, { actual: candidate([]int{5, 7, 3}, []int{2, 6, 3}), expected: "NO" }, { actual: candidate([]int{3, 2, 6, 1, 8, 9}, []int{3, 5, 5, 1, 1, 1}), expected: "NO" }, { actual: candidate([]int{100, 200}, []int{200, 200}), expected: "YES" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_111_histogram
go_test.go
package histogram_test import ( "testing" "fmt" ) // 空白で区切られた小文字を表す文字列が与えられる。最も出現回数が多い文字と // 対応するカウントの辞書を返す。 // 複数の文字が同じ出現回数を持つ場合、それらすべてを返す。 // 例: // >>> histogram("a b c") // map[string]int{"a": 1, "b": 1, "c": 1} // >>> histogram("a b b a") // map[string]int{"a": 2, "b": 2} // >>> histogram("a b c a b") // map[string]int{"a": 2, "b": 2} // >>> histogram("b b b b a") // map[string]int{"b": 4} // >>> histogram("") // map[string]int{} func histogram(test string) map[string]int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
reworded
func TestHistogram(t *testing.T) { candidate := histogram type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("a b b a"), expected: map[string]int{"a": 2, "b": 2} }, { actual: candidate("a b c a b"), expected: map[string]int{"a": 2, "b": 2} }, { actual: candidate("a b c d g"), expected: map[string]int{"a": 1, "b": 1, "c": 1, "d": 1, "g": 1} }, { actual: candidate("r t g"), expected: map[string]int{"r": 1, "t": 1, "g": 1} }, { actual: candidate("b b b b a"), expected: map[string]int{"b": 4} }, { actual: candidate("r t g"), expected: map[string]int{"r": 1, "t": 1, "g": 1} }, { actual: candidate(""), expected: map[string]int{} }, { actual: candidate("a"), expected: map[string]int{"a": 1} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_112_reverse_delete
go_test.go
package reverse_delete_test import ( "testing" "fmt" ) // 課題 // sとcの2つの文字列が与えられる。sに含まれる文字のうち、cに含まれる文字と // 等しいものをすべて削除し、その結果の文字列が回文かどうかをチェックする。 // 文字列は、後ろから読んでも前から読んでも同じであれば回文と呼ばれる。 // 結果文字列とチェックのためのtrue/falseを含むタプルを返す必要がある。 // 例 // >>> reverse_delete("abcde", "ae") // []interface{}{"bcd", false} // >>> reverse_delete("abcdef", "b") // []interface{}{"acdef", false} // >>> reverse_delete("abcdedcba", "ab") // []interface{}{"cdedc", true} func reverse_delete(s string, c string) []interface{} {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
reworded
func TestReverse_Delete(t *testing.T) { candidate := reverse_delete type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("abcde", "ae"), expected: []interface{}{"bcd", false} }, { actual: candidate("abcdef", "b"), expected: []interface{}{"acdef", false} }, { actual: candidate("abcdedcba", "ab"), expected: []interface{}{"cdedc", true} }, { actual: candidate("dwik", "w"), expected: []interface{}{"dik", false} }, { actual: candidate("a", "a"), expected: []interface{}{"", true} }, { actual: candidate("abcdedcba", ""), expected: []interface{}{"abcdedcba", true} }, { actual: candidate("abcdedcba", "v"), expected: []interface{}{"abcdedcba", true} }, { actual: candidate("vabba", "v"), expected: []interface{}{"abba", true} }, { actual: candidate("mamma", "mia"), expected: []interface{}{"", true} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_113_odd_count
go_test.go
package odd_count_test import ( "testing" "fmt" ) // 数字のみで構成された文字列のリストを引数として受け取り、新しいリストを返します。 // 出力される新しいリストの各要素は、"the number of odd elements in the string i of the // input."となりますが、この文字列内のすべての 'i' は、入力リストのi番目の文字列に含ま // る奇数の数に置き換えられます。 // >>> odd_count([]string{"1234567"}) // []string{"the number of odd elements 4n the str4ng 4 of the 4nput."} // >>> odd_count([]string{"3", "11111111"}) // []string{"the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."} func odd_count(lst []string) []string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
reworded
func TestOdd_Count(t *testing.T) { candidate := odd_count type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]string{"1234567"}), expected: []string{"the number of odd elements 4n the str4ng 4 of the 4nput."} }, { actual: candidate([]string{"3", "11111111"}), expected: []string{"the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."} }, { actual: candidate([]string{"271", "137", "314"}), expected: []string{"the number of odd elements 2n the str2ng 2 of the 2nput.", "the number of odd elements 3n the str3ng 3 of the 3nput.", "the number of odd elements 2n the str2ng 2 of the 2nput."} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_114_minSubArraySum
go_test.go
package minSubArraySum_test import ( "testing" "fmt" ) // 整数の配列 nums が与えられたとき、nums の空でない部分配列の最小和を求めよ。 // 例: // >>> minSubArraySum([]int{2, 3, 4, 1, 2, 4}) // 1 // >>> minSubArraySum([]int{-1, -2, -3}) // -6 func minSubArraySum(nums []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
reworded
func TestMinsubarraysum(t *testing.T) { candidate := minSubArraySum type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{2, 3, 4, 1, 2, 4}), expected: 1 }, { actual: candidate([]int{-1, -2, -3}), expected: -6 }, { actual: candidate([]int{-1, -2, -3, 2, -10}), expected: -14 }, { actual: candidate([]int{-9999999999999999}), expected: -9999999999999999 }, { actual: candidate([]int{0, 10, 20, 1000000}), expected: 0 }, { actual: candidate([]int{-1, -2, -3, 10, -5}), expected: -6 }, { actual: candidate([]int{100, -1, -2, -3, 10, -5}), expected: -6 }, { actual: candidate([]int{10, 11, 13, 8, 3, 4}), expected: 3 }, { actual: candidate([]int{100, -33, 32, -1, 0, -2}), expected: -33 }, { actual: candidate([]int{-10}), expected: -10 }, { actual: candidate([]int{7}), expected: 7 }, { actual: candidate([]int{1, -1}), expected: -1 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_115_max_fill
go_test.go
package max_fill_test import ( "testing" "fmt" ) // 長方形のグリッド状(grid)の井戸が与えられる。各行が1つの井戸を表し、 // 行の1が1単位の水を表す。 // 各井戸には,そこから水を汲み上げるのに使える対応するバケツがあり, // すべてのバケツ容量(capacity)は同じである. // あなたの仕事は,バケツを使って井戸を空にすることである. // バケツを降ろす回数を出力せよ. // 例 1: //>>> max_fill([][]int{[]int{0, 0, 1, 0}, []int{0, 1, 0, 0}, []int{1, 1, 1, 1}}, 1) // 6 // 例 2: // >>> max_fill([][]int{[]int{0, 0, 1, 1}, []int{0, 0, 0, 0}, []int{1, 1, 1, 1}, []int{0, 1, 1, 1}}, 2) // 5 // 例 3: // >>> max_fill([][]int{[]int{0, 0, 0}, []int{0, 0, 0}}, 5) // 0 // 制約: // * すべての井戸が同じ長さ // * 1 <= grid.length <= 10^2 // * 1 <= grid[:,1].length <= 10^2 // * grid[i][j] -> 0 | 1 // * 1 <= capacity <= 10 func max_fill(grid [][]int, capacity int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
reworded
func TestMax_Fill(t *testing.T) { candidate := max_fill type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([][]int{[]int{0, 0, 1, 0}, []int{0, 1, 0, 0}, []int{1, 1, 1, 1}}, 1), expected: 6 }, { actual: candidate([][]int{[]int{0, 0, 1, 1}, []int{0, 0, 0, 0}, []int{1, 1, 1, 1}, []int{0, 1, 1, 1}}, 2), expected: 5 }, { actual: candidate([][]int{[]int{0, 0, 0}, []int{0, 0, 0}}, 5), expected: 0 }, { actual: candidate([][]int{[]int{1, 1, 1, 1}, []int{1, 1, 1, 1}}, 2), expected: 4 }, { actual: candidate([][]int{[]int{1, 1, 1, 1}, []int{1, 1, 1, 1}}, 9), expected: 2 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_116_sort_array
go_test.go
package sort_array_test import ( "testing" "fmt" ) // この問題では、非負整数の配列を2進数表現における"1"の個数を昇順でソートする。 // "1"の個数が同じ場合は,10進数に基づいてソートする。 // 次のように実装する: // >>> sort_array([]int{1, 5, 2, 3, 4}) // []int{1, 2, 3, 4, 5} // >>> sort_array([]int{-2, -3, -4, -5, -6}) // []int{-6, -5, -4, -3, -2} // >>> sort_array([]int{1, 0, 2, 3, 4}) // []int{0, 1, 2, 3, 4} func sort_array(arr []int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
reworded
func TestSort_Array(t *testing.T) { candidate := sort_array type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 5, 2, 3, 4}), expected: []int{1, 2, 4, 3, 5} }, { actual: candidate([]int{-2, -3, -4, -5, -6}), expected: []int{-4, -2, -6, -5, -3} }, { actual: candidate([]int{1, 0, 2, 3, 4}), expected: []int{0, 1, 2, 4, 3} }, { actual: candidate([]int{}), expected: []int{} }, { actual: candidate([]int{2, 5, 77, 4, 5, 3, 5, 7, 2, 3, 4}), expected: []int{2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77} }, { actual: candidate([]int{3, 6, 44, 12, 32, 5}), expected: []int{32, 3, 5, 6, 12, 44} }, { actual: candidate([]int{2, 4, 8, 16, 32}), expected: []int{2, 4, 8, 16, 32} }, { actual: candidate([]int{2, 4, 8, 16, 32}), expected: []int{2, 4, 8, 16, 32} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_117_select_words
go_test.go
package select_words_test import ( "testing" "fmt" ) // ある文字列sと自然数nが与えらる。あなたに課せられたタスクは、文字列s // の中から、ちょうどn個の子音を含むすべての単語のリストを現れる順に返す // 関数を実装することである。 // 注意:入力文字列には英文字と空白しか含まれないと仮定してもよい。 // 例: // >>> select_words("Mary had a little lamb", 4) // []string{"little"} // >>> select_words("Mary had a little lamb", 3) // []string{"Mary", "lamb"} // >>> select_words("simple white space", 2) // []string{} // >>> select_words("Hello world", 4) // []string{"world"} // >>> select_words("Uncle sam", 3) // []string{"Uncle"} func select_words(s string, n int) []string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
reworded
func TestSelect_Words(t *testing.T) { candidate := select_words type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("Mary had a little lamb", 4), expected: []string{"little"} }, { actual: candidate("Mary had a little lamb", 3), expected: []string{"Mary", "lamb"} }, { actual: candidate("simple white space", 2), expected: []string{} }, { actual: candidate("Hello world", 4), expected: []string{"world"} }, { actual: candidate("Uncle sam", 3), expected: []string{"Uncle"} }, { actual: candidate("", 4), expected: []string{} }, { actual: candidate("a b c d e f", 1), expected: []string{"b", "c", "d", "f"} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_118_get_closest_vowel
go_test.go
package get_closest_vowel_test import ( "testing" "fmt" ) // 単語が与えられる。あなたの仕事は、単語の右側から2つの子音(大文字と // 小文字を区別)の間に立っている最も近い母音を見つけることである。 // 最初と最後の母音はカウントされない。上記の条件を満たす母音が見つから // なかった場合は、空の文字列を返せ。 // 指定された文字列は英字のみを含むとみなしてよい。 // 例: // >>> get_closest_vowel("yogurt") // "u" // >>> get_closest_vowel("FULL") // "U" // >>> get_closest_vowel("quick") // "" // >>> get_closest_vowel("ab") // "" func get_closest_vowel(word string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py
reworded
func TestGet_Closest_Vowel(t *testing.T) { candidate := get_closest_vowel type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("yogurt"), expected: "u" }, { actual: candidate("full"), expected: "u" }, { actual: candidate("easy"), expected: "" }, { actual: candidate("eAsy"), expected: "" }, { actual: candidate("ali"), expected: "" }, { actual: candidate("bad"), expected: "a" }, { actual: candidate("most"), expected: "o" }, { actual: candidate("ab"), expected: "" }, { actual: candidate("ba"), expected: "" }, { actual: candidate("quick"), expected: "" }, { actual: candidate("anime"), expected: "i" }, { actual: candidate("Asia"), expected: "" }, { actual: candidate("Above"), expected: "o" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_119_match_parens
go_test.go
package match_parens_test import ( "testing" "fmt" ) // 2つの文字列からなるリストが与えられます。両方の文字列は開き括弧 '(' または // 閉じ括弧 ')' のみで構成されています。 // あなたの仕事は、2つの文字列を何らかの順序で結合して、「良い」文字列にすることが // 可能かどうかを確認することです。 // 文字列Sが「良い」とは、文字列内のすべての括弧がバランスしている場合に限ります。 // 例えば、文字列 '(())()' は良いですが、文字列 '())' は良くありません。 // 良い文字列を作る方法がある場合は 'Yes' を返し、そうでない場合は 'No' を返してください。 // 例 // >>> match_parens([]string{"()(", ")"}) // "Yes" // >>> match_parens([]string{")", ")"}) // "No" func match_parens(lst []string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
reworded
func TestMatch_Parens(t *testing.T) { candidate := match_parens type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]string{"()(", ")"}), expected: "Yes" }, { actual: candidate([]string{")", ")"}), expected: "No" }, { actual: candidate([]string{"(()(())", "())())"}), expected: "No" }, { actual: candidate([]string{")())", "(()()("}), expected: "Yes" }, { actual: candidate([]string{"(())))", "(()())(("}), expected: "Yes" }, { actual: candidate([]string{"()", "())"}), expected: "No" }, { actual: candidate([]string{"(()(", "()))()"}), expected: "Yes" }, { actual: candidate([]string{"((((", "((())"}), expected: "No" }, { actual: candidate([]string{")(()", "(()("}), expected: "No" }, { actual: candidate([]string{")(", ")("}), expected: "No" }, { actual: candidate([]string{"(", ")"}), expected: "Yes" }, { actual: candidate([]string{")", "("}), expected: "Yes" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_120_maximum
go_test.go
package maximum_test import ( "testing" "fmt" ) // 整数の配列 arr と正の整数 k が与えられる。arr に含まれる大きい方から k 個の数を含む // 長さ k のソート済みリストを返す。 // 例 1: // >>> maximum([]int{-3, -4, 5}, 3) // []int{-4, -3, 5} // 例 2: // >>> maximum([]int{4, -4, 4}, 2) // []int{4, 4} // 例 3: // >>> maximum([]int{-3, 2, 1, 2, -1, -2, 1}, 1) // []int{2} // ノート: // 1. 配列の長さは[1, 1000]の範囲とする。 // 2. 配列の要素は [-1000, 1000] の範囲にある。 // 3. 0 <= k <= len(arr) func maximum(arr []int, k int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py
reworded
func TestMaximum(t *testing.T) { candidate := maximum type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{-3, -4, 5}, 3), expected: []int{-4, -3, 5} }, { actual: candidate([]int{4, -4, 4}, 2), expected: []int{4, 4} }, { actual: candidate([]int{-3, 2, 1, 2, -1, -2, 1}, 1), expected: []int{2} }, { actual: candidate([]int{123, -123, 20, 0, 1, 2, -3}, 3), expected: []int{2, 20, 123} }, { actual: candidate([]int{-123, 20, 0, 1, 2, -3}, 4), expected: []int{0, 1, 2, 20} }, { actual: candidate([]int{5, 15, 0, 3, -13, -8, 0}, 7), expected: []int{-13, -8, 0, 0, 3, 5, 15} }, { actual: candidate([]int{-1, 0, 2, 5, 3, -10}, 2), expected: []int{3, 5} }, { actual: candidate([]int{1, 0, 5, -7}, 1), expected: []int{5} }, { actual: candidate([]int{4, -4}, 2), expected: []int{-4, 4} }, { actual: candidate([]int{-10, 10}, 2), expected: []int{-10, 10} }, { actual: candidate([]int{1, 2, 3, -23, 243, -400, 0}, 0), expected: []int{} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_121_solution
go_test.go
package solution_test import ( "testing" "fmt" ) // 整数の空でないリストが与えられた時、偶数の位置にある奇数の要素の合計を返す。 // 例 // >>> solution([]int{5, 8, 7, 1}) // 12 // >>> solution([]int{3, 3, 3, 3, 3}) // 9 // >>> solution([]int{30, 13, 24, 321}) // 0 func solution(lst []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py
reworded
func TestSolution(t *testing.T) { candidate := solution type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{5, 8, 7, 1}), expected: 12 }, { actual: candidate([]int{3, 3, 3, 3, 3}), expected: 9 }, { actual: candidate([]int{30, 13, 24, 321}), expected: 0 }, { actual: candidate([]int{5, 9}), expected: 5 }, { actual: candidate([]int{2, 4, 8}), expected: 0 }, { actual: candidate([]int{30, 13, 23, 32}), expected: 23 }, { actual: candidate([]int{3, 13, 2, 9}), expected: 3 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_122_add_elements
go_test.go
package add_elements_test import ( "testing" "fmt" ) // 整数の空でない配列 arr と整数 k が与えられたとき、 // arr の最初の k 個の要素から高々 2 桁までの要素の和を返す。 // 例: // >>> add_elements([]int{111, 21, 3, 4000, 5, 6, 7, 8, 9}, 4) // 24 // # 21 + 3 の話 // 制約: // 1. 1 <= len(arr) <= 100 // 2. 1 <= k <= len(arr) func add_elements(arr []int, k int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py
reworded
func TestAdd_Elements(t *testing.T) { candidate := add_elements type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, -2, -3, 41, 57, 76, 87, 88, 99}, 3), expected: -4 }, { actual: candidate([]int{111, 121, 3, 4000, 5, 6}, 2), expected: 0 }, { actual: candidate([]int{11, 21, 3, 90, 5, 6, 7, 8, 9}, 4), expected: 125 }, { actual: candidate([]int{111, 21, 3, 4000, 5, 6, 7, 8, 9}, 4), expected: 24 }, { actual: candidate([]int{1}, 1), expected: 1 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_123_get_odd_collatz
go_test.go
package get_odd_collatz_test import ( "testing" "fmt" ) // 正の整数nが与えられたとき、コラッツ数列の奇数を持つソートされたリストを返す。 // コラッツ予想とは数学の予想で、次のように定義される数列に関するものである: // 任意の正の整数nから始め、各項は前の項から次のように求められる。 // 前の項が偶数なら、次の項は前の項の2分の1である。前の項が奇数の場合、次の項は前の項の3倍+1である。 // 予想では、nがどのような値であっても、数列は必ず1に達する。 // 注: // 1. Collatz(1)は[1]である。 // 2. 返されるリストは昇順にソートされている。 // 例えば: // get_odd_collatz(5) は [1, 5]を返す。つまり、5に対するコラッツ数列 は、[5, 16, 8, 4, 2, 1]であり、 奇数は 1 と 5 である。 // >>> get_odd_collatz(5) // []int{1, 5} func get_odd_collatz(n int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py
reworded
func TestGet_Odd_Collatz(t *testing.T) { candidate := get_odd_collatz type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(14), expected: []int{1, 5, 7, 11, 13, 17} }, { actual: candidate(5), expected: []int{1, 5} }, { actual: candidate(12), expected: []int{1, 3, 5} }, { actual: candidate(1), expected: []int{1} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_124_valid_date
go_test.go
package valid_date_test import ( "testing" "fmt" ) // 与えられた日付文字列を検証し、その日付が有効であればtrueを、そうでなければfalseを返す関数を書く必要がある。 // 日付が有効であるのは、以下のルールがすべて満たされている場合である: // 1. 日付文字列が空でない。 // 2. 日数が、月1,3,5,7,8,10,12の場合、1日以上31日以下である。また、月4,6,9,11については、日数が1以上30日以下である。また、月2については、日数が1以上29以下であること。 // 3. 月は1未満または12以上であってはならない。 // 4. 日付はmm-dd-yyyyの形式でなければならない。 // >>> valid_date("03-11-2000") // true // >>> valid_date("15-01-2012") // false // >>> valid_date("04-0-2040") // false // >>> valid_date("06-04-2020") // true // >>> valid_date("06/04/2020") // false func valid_date(date string) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py
reworded
func TestValid_Date(t *testing.T) { candidate := valid_date type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("03-11-2000"), expected: true }, { actual: candidate("15-01-2012"), expected: false }, { actual: candidate("04-0-2040"), expected: false }, { actual: candidate("06-04-2020"), expected: true }, { actual: candidate("01-01-2007"), expected: true }, { actual: candidate("03-32-2011"), expected: false }, { actual: candidate(""), expected: false }, { actual: candidate("04-31-3000"), expected: false }, { actual: candidate("06-06-2005"), expected: true }, { actual: candidate("21-31-2000"), expected: false }, { actual: candidate("04-12-2003"), expected: true }, { actual: candidate("04122003"), expected: false }, { actual: candidate("20030412"), expected: false }, { actual: candidate("2003-04"), expected: false }, { actual: candidate("2003-04-12"), expected: false }, { actual: candidate("04-2003"), expected: false }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_126_is_sorted
go_test.go
package is_sorted_test import ( "testing" "fmt" ) // 数字のリストが与えられたとき、昇順に整列されているかどうかを返す。 // リストに同じ数の重複が1つ以上ある場合は、falseを返す。 // 負の数はなく、整数のみであると仮定する。 // 例 // >>> is_sorted([]int{5}) // true // >>> is_sorted([]int{1, 2, 3, 4, 5}) // true // >>> is_sorted([]int{1, 3, 2, 4, 5}) // false // >>> is_sorted([]int{1, 2, 3, 4, 5, 6}) // true // >>> is_sorted([]int{1, 2, 3, 4, 5, 6, 7}) // true // >>> is_sorted([]int{1, 3, 2, 4, 5, 6, 7}) // false // >>> is_sorted([]int{1, 2, 2, 3, 3, 4}) // true // >>> is_sorted([]int{1, 2, 2, 2, 3, 4}) // false func is_sorted(lst []int) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py
reworded
func TestIs_Sorted(t *testing.T) { candidate := is_sorted type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{5}), expected: true }, { actual: candidate([]int{1, 2, 3, 4, 5}), expected: true }, { actual: candidate([]int{1, 3, 2, 4, 5}), expected: false }, { actual: candidate([]int{1, 2, 3, 4, 5, 6}), expected: true }, { actual: candidate([]int{1, 2, 3, 4, 5, 6, 7}), expected: true }, { actual: candidate([]int{1, 3, 2, 4, 5, 6, 7}), expected: false }, { actual: candidate([]int{}), expected: true }, { actual: candidate([]int{1}), expected: true }, { actual: candidate([]int{3, 2, 1}), expected: false }, { actual: candidate([]int{1, 2, 2, 2, 3, 4}), expected: false }, { actual: candidate([]int{1, 2, 3, 3, 3, 4}), expected: false }, { actual: candidate([]int{1, 2, 2, 3, 3, 4}), expected: true }, { actual: candidate([]int{1, 2, 3, 4}), expected: true }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_127_intersection
go_test.go
package intersection_test import ( "testing" "fmt" ) // 2つの区間が与えられます。 // それぞれの区間は整数のペアで示されます。例えば、区間 = (start, end ) = (1, 2) です。 // 与えられた区間は閉区間であり、start と end の両端が含まれます。 // 各区間について、start は end 以下であると仮定します。 // あなたの仕事は、これら2つの区間の交差部分の長さが素数であるかどうかを判断することです。 // 例えば、区間 (1, 3) と (2, 4) の交差部分は (2, 3) で、その長さは1ですが、これは素数ではありません。 // 交差部分の長さが素数であれば "YES" を返し、そうでなければ "NO" を返してください。 // もし2つの区間が交差しない場合も "NO" を返してください。 // [input/output] サンプル: // >>> intersection([]interface{}{1, 2}, []interface{}{2, 3}) // "NO" // >>> intersection([]interface{}{-1, 1}, []interface{}{0, 4}) // "NO" // >>> intersection([]interface{}{-3, -1}, []interface{}{-5, 5}) // "YES" func intersection(interval1 []interface{}, interval2 []interface{}) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py
reworded
func TestIntersection(t *testing.T) { candidate := intersection type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]interface{}{1, 2}, []interface{}{2, 3}), expected: "NO" }, { actual: candidate([]interface{}{-1, 1}, []interface{}{0, 4}), expected: "NO" }, { actual: candidate([]interface{}{-3, -1}, []interface{}{-5, 5}), expected: "YES" }, { actual: candidate([]interface{}{-2, 2}, []interface{}{-4, 0}), expected: "YES" }, { actual: candidate([]interface{}{-11, 2}, []interface{}{-1, -1}), expected: "NO" }, { actual: candidate([]interface{}{1, 2}, []interface{}{3, 5}), expected: "NO" }, { actual: candidate([]interface{}{1, 2}, []interface{}{1, 2}), expected: "NO" }, { actual: candidate([]interface{}{-2, -2}, []interface{}{-3, -2}), expected: "NO" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_129_minPath
go_test.go
package minPath_test import ( "testing" "fmt" ) // N行とN列 (N >= 2)) のグリッドと正の整数kが与えられた場合、各セルには値が含まれている。 // 囲[1, N * N](両端を含む)のすべての整数は、グリッドのセルに一度だけ表れる。 // このグリッド内で長さkの最短の経路を見つける必要がある。任意のセルからスタートでき、 // 各ステップで隣接するセルに移動できる。言い換えれば、現在のセルと辺を共有するセルに // 移動できる。長さkの経路とは、正確にk個のセル(必ずしも異なるとは限らない)を訪れる // ことを意味する。ただし、グリッドから出ることはない。 // 長さkの2つの経路AとBがある場合、AとBが通るセルの値を順番にリスト化したものを // それぞれlst_A、lst_Bと呼ぶ。lst_Aがlst_Bより辞書順で小さい場合、経路Aは経路Bよりも // 小さいとする。つまり、整数インデックスi( 1 <= i <= k ) が存在して、lst_A[i] < lst_B[i] となり、 // 任意の j( 1 <= j < i )に対して lst_A[j] = lst_B[j] が成立する。 // 答えは一意であることが保証されている。 // 最短の経路が通るセルの値の順番に並べたリストを返すようにせよ。 // 例: // >>> minPath([][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}, 3) // []int{1, 2, 1} // >>> minPath([][]int{[]int{5, 9, 3}, []int{4, 1, 6}, []int{7, 8, 2}}, 1) // []int{1} func minPath(grid [][]int, k int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py
reworded
func TestMinpath(t *testing.T) { candidate := minPath type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([][]int{[]int{1, 2, 3}, []int{4, 5, 6}, []int{7, 8, 9}}, 3), expected: []int{1, 2, 1} }, { actual: candidate([][]int{[]int{5, 9, 3}, []int{4, 1, 6}, []int{7, 8, 2}}, 1), expected: []int{1} }, { actual: candidate([][]int{[]int{1, 2, 3, 4}, []int{5, 6, 7, 8}, []int{9, 10, 11, 12}, []int{13, 14, 15, 16}}, 4), expected: []int{1, 2, 1, 2} }, { actual: candidate([][]int{[]int{6, 4, 13, 10}, []int{5, 7, 12, 1}, []int{3, 16, 11, 15}, []int{8, 14, 9, 2}}, 7), expected: []int{1, 10, 1, 10, 1, 10, 1} }, { actual: candidate([][]int{[]int{8, 14, 9, 2}, []int{6, 4, 13, 15}, []int{5, 7, 1, 12}, []int{3, 10, 11, 16}}, 5), expected: []int{1, 7, 1, 7, 1} }, { actual: candidate([][]int{[]int{11, 8, 7, 2}, []int{5, 16, 14, 4}, []int{9, 3, 15, 6}, []int{12, 13, 10, 1}}, 9), expected: []int{1, 6, 1, 6, 1, 6, 1, 6, 1} }, { actual: candidate([][]int{[]int{12, 13, 10, 1}, []int{9, 3, 15, 6}, []int{5, 16, 14, 4}, []int{11, 8, 7, 2}}, 12), expected: []int{1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6} }, { actual: candidate([][]int{[]int{2, 7, 4}, []int{3, 1, 5}, []int{6, 8, 9}}, 8), expected: []int{1, 3, 1, 3, 1, 3, 1, 3} }, { actual: candidate([][]int{[]int{6, 1, 5}, []int{3, 8, 9}, []int{2, 7, 4}}, 8), expected: []int{1, 5, 1, 5, 1, 5, 1, 5} }, { actual: candidate([][]int{[]int{1, 2}, []int{3, 4}}, 10), expected: []int{1, 2, 1, 2, 1, 2, 1, 2, 1, 2} }, { actual: candidate([][]int{[]int{1, 3}, []int{3, 2}}, 10), expected: []int{1, 3, 1, 3, 1, 3, 1, 3, 1, 3} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_130_tri
go_test.go
package tri_test import ( "testing" "fmt" ) // フィボナッチ数列は、ここ数世紀の間に数学者によって深く研究され、誰もが知っている。 // しかし、人々が知らないのはトリボナッチ数列である。 // トリボナッチ数列は再帰によって定義される: // tri(1) = 3 // tri(n) = 1 + n / 2, n が偶数の場合. // tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), n が奇数の場合d. // 例えば: // tri(2) = 1 + (2 / 2) = 2 // tri(4) = 3 // tri(3) = tri(2) + tri(1) + tri(4) // = 2 + 3 + 3 = 8 // あなたは非負の整数nが与えられるので、トリボナッチ数列の最初のn + 1個の数の // リストを返さなければならない。 // 例: // >>> tri(3) // []int{1, 3, 2, 8} func tri(n int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py
reworded
func TestTri(t *testing.T) { candidate := tri type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(3), expected: []int{1, 3, 2, 8} }, { actual: candidate(4), expected: []int{1, 3, 2, 8, 3} }, { actual: candidate(5), expected: []int{1, 3, 2, 8, 3, 15} }, { actual: candidate(6), expected: []int{1, 3, 2, 8, 3, 15, 4} }, { actual: candidate(7), expected: []int{1, 3, 2, 8, 3, 15, 4, 24} }, { actual: candidate(8), expected: []int{1, 3, 2, 8, 3, 15, 4, 24, 5} }, { actual: candidate(9), expected: []int{1, 3, 2, 8, 3, 15, 4, 24, 5, 35} }, { actual: candidate(20), expected: []int{1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11} }, { actual: candidate(0), expected: []int{1} }, { actual: candidate(1), expected: []int{1, 3} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_131_digits
go_test.go
package digits_test import ( "testing" "fmt" ) // 正の整数 n が与えられた時、奇数桁数の積を返す。 // 全ての桁が偶数の場合は0を返す。 // 例えば: // >>> digits(1) // 1 // >>> digits(4) // 0 // >>> digits(235) // 15 func digits(n int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py
reworded
func TestDigits(t *testing.T) { candidate := digits type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(5), expected: 5 }, { actual: candidate(54), expected: 5 }, { actual: candidate(120), expected: 1 }, { actual: candidate(5014), expected: 5 }, { actual: candidate(98765), expected: 315 }, { actual: candidate(5576543), expected: 2625 }, { actual: candidate(2468), expected: 0 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_132_is_nested
go_test.go
package is_nested_test import ( "testing" "fmt" ) // この関数は、角括弧だけを含む文字列を入力として受け取ります。括弧が有効な順序で // 並んでいて、その中に少なくとも1つの括弧が入れ子になっている場合、関数はtrueを // 返すようにしてください。 // >>> is_nested("[[]]") // true // >>> is_nested("[]]]]]]][[[[[]") // false // >>> is_nested("[][]") // false // >>> is_nested("[]") // false // >>> is_nested("[[][]]") // true // >>> is_nested("[[]][[") // true func is_nested(myString string) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py
reworded
func TestIs_Nested(t *testing.T) { candidate := is_nested type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("[[]]"), expected: true }, { actual: candidate("[]]]]]]][[[[[]"), expected: false }, { actual: candidate("[][]"), expected: false }, { actual: candidate("[]"), expected: false }, { actual: candidate("[[[[]]]]"), expected: true }, { actual: candidate("[]]]]]]]]]]"), expected: false }, { actual: candidate("[][][[]]"), expected: true }, { actual: candidate("[[]"), expected: false }, { actual: candidate("[]]"), expected: false }, { actual: candidate("[[]][["), expected: true }, { actual: candidate("[[][]]"), expected: true }, { actual: candidate(""), expected: false }, { actual: candidate("[[[[[[[["), expected: false }, { actual: candidate("]]]]]]]]"), expected: false }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_133_sum_squares
go_test.go
package sum_squares_test import ( "testing" "fmt" ) // 数字のリストが与えられます。 // 与えられたリスト内の各数値をまず切り上げ(天井関数を使って最も近い整数に丸める)、 // その後それぞれの数値を二乗した値の合計を返してください。 // 例: // >>> lst([]float64{1.0, 2.0, 3.0}) // 14 // >>> lst([]float64{1.0, 4.0, 9.0}) // 98 // >>> lst([]float64{1.0, 3.0, 5.0, 7.0}) // 84 // >>> lst([]float64{1.4, 4.2, 0.0}) // 29 // >>> lst([]float64{-2.4, 1.0, 1.0}) // 6 func sum_squares(lst []float64) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py
reworded
func TestSum_Squares(t *testing.T) { candidate := sum_squares type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]float64{1.0, 2.0, 3.0}), expected: 14 }, { actual: candidate([]float64{1.0, 2.0, 3.0}), expected: 14 }, { actual: candidate([]float64{1.0, 3.0, 5.0, 7.0}), expected: 84 }, { actual: candidate([]float64{1.4, 4.2, 0.0}), expected: 29 }, { actual: candidate([]float64{-2.4, 1.0, 1.0}), expected: 6 }, { actual: candidate([]float64{100.0, 1.0, 15.0, 2.0}), expected: 10230 }, { actual: candidate([]float64{10000.0, 10000.0}), expected: 200000000 }, { actual: candidate([]float64{-1.4, 4.6, 6.3}), expected: 75 }, { actual: candidate([]float64{-1.4, 17.9, 18.9, 19.9}), expected: 1086 }, { actual: candidate([]float64{0.0}), expected: 0 }, { actual: candidate([]float64{-1.0}), expected: 1 }, { actual: candidate([]float64{-1.0, 1.0, 0.0}), expected: 2 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_134_check_if_last_char_is_a_letter
go_test.go
package check_if_last_char_is_a_letter_test import ( "testing" "fmt" ) // 与えられた文字列の最後の文字がアルファベットであり、かつ単語の一部でなければtrueを、 // そうでなければfalseを返す関数を作成せよ。 // 注意:単語とはスペースで区切られた文字の並びである。 // 例: // >>> check_if_last_char_is_a_letter("apple pie") // false // >>> check_if_last_char_is_a_letter("apple pi e") // true // >>> check_if_last_char_is_a_letter("apple pi e ") // false // >>> check_if_last_char_is_a_letter("") // false func check_if_last_char_is_a_letter(txt string) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py
reworded
func TestCheck_If_Last_Char_Is_A_Letter(t *testing.T) { candidate := check_if_last_char_is_a_letter type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("apple"), expected: false }, { actual: candidate("apple pi e"), expected: true }, { actual: candidate("eeeee"), expected: false }, { actual: candidate("A"), expected: true }, { actual: candidate("Pumpkin pie "), expected: false }, { actual: candidate("Pumpkin pie 1"), expected: false }, { actual: candidate(""), expected: false }, { actual: candidate("eeeee e "), expected: false }, { actual: candidate("apple pie"), expected: false }, { actual: candidate("apple pi e "), expected: false }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_135_can_arrange
go_test.go
package can_arrange_test import ( "testing" "fmt" ) // 直前の要素よりも大きくない要素の中で、最も大きなインデックスを持つ要素を探して // そのインデックスを返す関数を作成してください。そのような要素が存在しない場合は、 // -1を返してください。与えられる配列には重複する値は含まれません。 // 例: // >>> can_arrange([]int{1, 2, 4, 3, 5}) // 3 // >>> can_arrange([]int{1, 2, 3}) // -1 func can_arrange(arr []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py
reworded
func TestCan_Arrange(t *testing.T) { candidate := can_arrange type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 2, 4, 3, 5}), expected: 3 }, { actual: candidate([]int{1, 2, 4, 5}), expected: -1 }, { actual: candidate([]int{1, 4, 2, 5, 6, 7, 8, 9, 10}), expected: 2 }, { actual: candidate([]int{4, 8, 5, 7, 3}), expected: 4 }, { actual: candidate([]int{}), expected: -1 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_136_largest_smallest_integers
go_test.go
package largest_smallest_integers_test import ( "testing" "fmt" ) // リストから最も大きな負の整数と最も小さな正の整数を見つけ、それらをタプル(a, b) // として返す関数を作成してください。リストに負の整数もしくは正の整数がない場合は、 // 代わりにnilを返します。 // 例: // >>> largest_smallest_integers([]int{2, 4, 1, 3, 5, 7}) // []interface{}{nil, 1} // >>> largest_smallest_integers([]int{}) // []interface{}{nil, nil} // >>> largest_smallest_integers([]int{0}) // []interface{}{nil, nil} func largest_smallest_integers(lst []int) []interface{} {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py
reworded
func TestLargest_Smallest_Integers(t *testing.T) { candidate := largest_smallest_integers type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{2, 4, 1, 3, 5, 7}), expected: []interface{}{nil, 1} }, { actual: candidate([]int{2, 4, 1, 3, 5, 7, 0}), expected: []interface{}{nil, 1} }, { actual: candidate([]int{1, 3, 2, 4, 5, 6, -2}), expected: []interface{}{-2, 1} }, { actual: candidate([]int{4, 5, 3, 6, 2, 7, -7}), expected: []interface{}{-7, 2} }, { actual: candidate([]int{7, 3, 8, 4, 9, 2, 5, -9}), expected: []interface{}{-9, 2} }, { actual: candidate([]int{}), expected: []interface{}{nil, nil} }, { actual: candidate([]int{0}), expected: []interface{}{nil, nil} }, { actual: candidate([]int{-1, -3, -5, -6}), expected: []interface{}{-1, nil} }, { actual: candidate([]int{-1, -3, -5, -6, 0}), expected: []interface{}{-1, nil} }, { actual: candidate([]int{-6, -4, -4, -3, 1}), expected: []interface{}{-3, 1} }, { actual: candidate([]int{-6, -4, -4, -3, -100, 1}), expected: []interface{}{-3, 1} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_138_is_equal_to_sum_even
go_test.go
package is_equal_to_sum_even_test import ( "testing" "fmt" ) // 与えられた数値nが、ちょうど4つの正の偶数の合計として表現できるかどうかを評価してください。 // 例 // >>> is_equal_to_sum_even(4) // false // >>> is_equal_to_sum_even(6) // false // >>> is_equal_to_sum_even(8) // true func is_equal_to_sum_even(n int) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py
reworded
func TestIs_Equal_To_Sum_Even(t *testing.T) { candidate := is_equal_to_sum_even type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(4), expected: false }, { actual: candidate(6), expected: false }, { actual: candidate(8), expected: true }, { actual: candidate(10), expected: true }, { actual: candidate(11), expected: false }, { actual: candidate(12), expected: true }, { actual: candidate(13), expected: false }, { actual: candidate(16), expected: true }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_139_special_factorial
go_test.go
package special_factorial_test import ( "testing" "fmt" ) // ブラジリアン階乗は次のように定義される: // brazilian_factorial(n) = n!* (n-1)! * (n-2)! * ... * 1! // ただし n > 0 // 例えば: // >>> special_factorial(4) // 288 // この関数は入力として整数を受け取り、整数の特殊な階乗を返す。 func special_factorial(n int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py
reworded
func TestSpecial_Factorial(t *testing.T) { candidate := special_factorial type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(4), expected: 288 }, { actual: candidate(5), expected: 34560 }, { actual: candidate(7), expected: 125411328000 }, { actual: candidate(1), expected: 1 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_140_fix_spaces
go_test.go
package fix_spaces_test import ( "testing" "fmt" ) // 文字列テキストが与えられた場合、その中のすべての空白をアンダースコアに置換し、 // 文字列が2つ以上の連続した空白を持つ場合、すべての連続した空白を - に置換する // >>> fix_spaces(" Example 2") == "_Example_2" // fix_spaces(" Example 3") == "_Example-3"") // "Example" // >>> fix_spaces(" Example 2") == "_Example_2" // fix_spaces(" Example 3") == "_Example-3" 1") // "Example_1" // >>> fix_spaces(" Example 2") == "_Example_2" // fix_spaces(" Example 3") == "_Example-3" 2") // "_Example_2" // >>> fix_spaces(" Example 2") == "_Example_2" // fix_spaces(" Example 3") == "_Example-3" 3") // "_Example-3" func fix_spaces(text string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py
reworded
func TestFix_Spaces(t *testing.T) { candidate := fix_spaces type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("Example"), expected: "Example" }, { actual: candidate("Mudasir Hanif "), expected: "Mudasir_Hanif_" }, { actual: candidate("Yellow Yellow Dirty Fellow"), expected: "Yellow_Yellow__Dirty__Fellow" }, { actual: candidate("Exa mple"), expected: "Exa-mple" }, { actual: candidate(" Exa 1 2 2 mple"), expected: "-Exa_1_2_2_mple" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_141_file_name_check
go_test.go
package file_name_check_test import ( "testing" "fmt" ) // ファイル名を表す文字列を受け取り、そのファイル名が有効であれば'Yes'を返し、そうでなければ'No' // を返す関数を作成する。ファイル名が有効であるとみなされるのは、 // 以下の条件をすべて満たす場合のみである: // - ファイル名に3桁以上の数字('0'-'9')があってはならない。 // - ファイル名に含まれるドット '.' はひとつのみ。 // - ドットの前の部分文字列は空であってはならず、英文字('a'-'z'および'A'-'Z')から始まる文字でなければならない。 // - ドットの後の部分文字列は、以下のいずれかでなければならない: ['txt'、'exe'、'dll']。 // 例: // >>> file_name_check("example.txt") // "Yes" // >>> file_name_check("1example.dll") // "No"(名前は英文字で始まらないといけない) func file_name_check(file_name string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py
reworded
func TestFile_Name_Check(t *testing.T) { candidate := file_name_check type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("example.txt"), expected: "Yes" }, { actual: candidate("1example.dll"), expected: "No" }, { actual: candidate("s1sdf3.asd"), expected: "No" }, { actual: candidate("K.dll"), expected: "Yes" }, { actual: candidate("MY16FILE3.exe"), expected: "Yes" }, { actual: candidate("His12FILE94.exe"), expected: "No" }, { actual: candidate("_Y.txt"), expected: "No" }, { actual: candidate("?aREYA.exe"), expected: "No" }, { actual: candidate("/this_is_valid.dll"), expected: "No" }, { actual: candidate("this_is_valid.wow"), expected: "No" }, { actual: candidate("this_is_valid.txt"), expected: "Yes" }, { actual: candidate("this_is_valid.txtexe"), expected: "No" }, { actual: candidate("#this2_i4s_5valid.ten"), expected: "No" }, { actual: candidate("@this1_is6_valid.exe"), expected: "No" }, { actual: candidate("this_is_12valid.6exe4.txt"), expected: "No" }, { actual: candidate("all.exe.txt"), expected: "No" }, { actual: candidate("I563_No.exe"), expected: "Yes" }, { actual: candidate("Is3youfault.txt"), expected: "Yes" }, { actual: candidate("no_one#knows.dll"), expected: "Yes" }, { actual: candidate("1I563_Yes3.exe"), expected: "No" }, { actual: candidate("I563_Yes3.txtt"), expected: "No" }, { actual: candidate("final..txt"), expected: "No" }, { actual: candidate("final132"), expected: "No" }, { actual: candidate("_f4indsartal132."), expected: "No" }, { actual: candidate(".txt"), expected: "No" }, { actual: candidate("s."), expected: "No" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_142_sum_squares
go_test.go
package sum_squares_test import ( "testing" "fmt" ) // " // この関数は整数のリストを受け取ります。リスト内の各要素に対して、そのインデックスが3の倍数で // あればその整数を二乗し、インデックスが4の倍数でかつ3の倍数でない場合はその整数を三乗します。 // インデックスが3または4の倍数でない要素については、何も変更しません。最後に、すべての要素の // 合計値を返します。 // 例: // >>> lst // []int{1, 2, 3} // >>> lst // int{} // >>> lst // []int{-1, -5, 2, -1, -5} func sum_squares(lst []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py
reworded
func TestSum_Squares(t *testing.T) { candidate := sum_squares type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 2, 3}), expected: 6 }, { actual: candidate([]int{1, 4, 9}), expected: 14 }, { actual: candidate([]int{}), expected: 0 }, { actual: candidate([]int{1, 1, 1, 1, 1, 1, 1, 1, 1}), expected: 9 }, { actual: candidate([]int{-1, -1, -1, -1, -1, -1, -1, -1, -1}), expected: -3 }, { actual: candidate([]int{0}), expected: 0 }, { actual: candidate([]int{-1, -5, 2, -1, -5}), expected: -126 }, { actual: candidate([]int{-56, -99, 1, 0, -2}), expected: 3030 }, { actual: candidate([]int{-1, 0, 0, 0, 0, 0, 0, 0, -1}), expected: 0 }, { actual: candidate([]int{-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37}), expected: -14196 }, { actual: candidate([]int{-1, -3, 17, -1, -15, 13, -1, 14, -14, -12, -5, 14, -14, 6, 13, 11, 16, 16, 4, 10}), expected: -1448 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_143_words_in_sentence
go_test.go
package words_in_sentence_test import ( "testing" "fmt" ) // 文を表す文字列が与えられ、その文には空白で区切られたいくつかの単語が含まれている。 // 元の文の単語を含みその長さが素数である文字列を返す必要がある。 // 新しい文字列の単語の順序は元の文字列と同じでなければならない。 // 例 1: //>>> words_in_sentence("This is a test") // "is" // 例 2: // >>> words_in_sentence("lets go for swimming") // "go for" // 制約: // * 1 <= len(sentence) <= 100 // * sentence contains only letters func words_in_sentence(sentence string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py
reworded
func TestWords_In_Sentence(t *testing.T) { candidate := words_in_sentence type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("This is a test"), expected: "is" }, { actual: candidate("lets go for swimming"), expected: "go for" }, { actual: candidate("there is no place available here"), expected: "there is no place" }, { actual: candidate("Hi I am Hussein"), expected: "Hi am Hussein" }, { actual: candidate("go for it"), expected: "go for it" }, { actual: candidate("here"), expected: "" }, { actual: candidate("here is"), expected: "is" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_144_simplify
go_test.go
package simplify_test import ( "testing" "fmt" ) // あなたの仕事は、式 x * n を簡単にする関数を実装することです。 // この関数は、x * n が整数になる場合はtrueを、そうでない場合はfalseを // 返します。xとnはともに分数の文字列表現であり、<分子>/<分母>という形式で、 // 分子と分母はともに正の整数です。 // xとnが有効な分数であり、分母がゼロでないことは仮定してかまいません。 // >>> simplify("1/5", "5/1") // true // >>> simplify("1/6", "2/1") // false // >>> simplify("7/10", "10/2") // false func simplify(x string, n string) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py
reworded
func TestSimplify(t *testing.T) { candidate := simplify type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("1/5", "5/1"), expected: true }, { actual: candidate("1/6", "2/1"), expected: false }, { actual: candidate("5/1", "3/1"), expected: true }, { actual: candidate("7/10", "10/2"), expected: false }, { actual: candidate("2/10", "50/10"), expected: true }, { actual: candidate("7/2", "4/2"), expected: true }, { actual: candidate("11/6", "6/1"), expected: true }, { actual: candidate("2/3", "5/2"), expected: false }, { actual: candidate("5/2", "3/5"), expected: false }, { actual: candidate("2/4", "8/4"), expected: true }, { actual: candidate("2/4", "4/2"), expected: true }, { actual: candidate("1/5", "5/1"), expected: true }, { actual: candidate("1/5", "1/5"), expected: false }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_145_order_by_points
go_test.go
package order_by_points_test import ( "testing" "fmt" ) // 各数字の桁の合計に基づいて、与えられた整数のリストを昇順に並べる // 関数を作成してください。 // 注意:もし桁の合計が同じである複数の項目がある場合は、 // 元のリストでの位置に基づいて並べてください。 // 例えば // >>> order_by_points([]int{1, 11, -1, -11, -12}) // []int{-1, -11, 1, -12, 11} // >>> order_by_points([]int{}) // []int{} func order_by_points(nums []int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py
reworded
func TestOrder_By_Points(t *testing.T) { candidate := order_by_points type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 11, -1, -11, -12}), expected: []int{-1, -11, 1, -12, 11} }, { actual: candidate([]int{1234, 423, 463, 145, 2, 423, 423, 53, 6, 37, 3457, 3, 56, 0, 46}), expected: []int{0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457} }, { actual: candidate([]int{}), expected: []int{} }, { actual: candidate([]int{1, -11, -32, 43, 54, -98, 2, -3}), expected: []int{-3, -32, -98, -11, 1, 2, 43, 54} }, { actual: candidate([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), expected: []int{1, 10, 2, 11, 3, 4, 5, 6, 7, 8, 9} }, { actual: candidate([]int{0, 6, 6, -76, -21, 23, 4}), expected: []int{-76, -21, 0, 4, 23, 6, 6} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_146_specialFilter
go_test.go
package specialFilter_test import ( "testing" "fmt" ) // 数値の配列を入力とし、配列中の要素のうち、10より大きく、 // かつ数値の最初と最後の桁の両方が奇数(1, 3, 5, 7, 9)である要素の数を返す関数を書く。 // 例えば // >>> specialFilter([]int{15, -73, 14, -15}) // 1 // >>> specialFilter([]int{33, -2, -3, 45, 21, 109}) // 2 func specialFilter(nums []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py
reworded
func TestSpecialfilter(t *testing.T) { candidate := specialFilter type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{5, -2, 1, -5}), expected: 0 }, { actual: candidate([]int{15, -73, 14, -15}), expected: 1 }, { actual: candidate([]int{33, -2, -3, 45, 21, 109}), expected: 2 }, { actual: candidate([]int{43, -12, 93, 125, 121, 109}), expected: 4 }, { actual: candidate([]int{71, -2, -33, 75, 21, 19}), expected: 3 }, { actual: candidate([]int{1}), expected: 0 }, { actual: candidate([]int{}), expected: 0 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_147_get_max_triples
go_test.go
package get_max_triples_test import ( "testing" "fmt" ) // 正の整数 n が与えられるので、長さ n の整数配列 a を作成せよ。 // 各 i (1 ≤ i ≤ n) に対して、 a[i] = i * i - i + 1 とする。 //i < j < k において、a[i] + a[j] + a[k] が3の倍数となるような三つ組 (a[i], a[j], a[k]) を返す。 // 例 : // >>> get_max_triples(5) // 1 // 解説: // a = [1, 3, 7, 13, 21] // 唯一の妥当な三つ組は (1, 7, 13)である。 func get_max_triples(n int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py
reworded
func TestGet_Max_Triples(t *testing.T) { candidate := get_max_triples type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(5), expected: 1 }, { actual: candidate(6), expected: 4 }, { actual: candidate(10), expected: 36 }, { actual: candidate(100), expected: 53361 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_148_bf
go_test.go
package bf_test import ( "testing" "fmt" ) // 私たちの太陽系には8つの惑星があります:太陽に最も近いのはVenus, Earth, Mars, Jupiter, Saturn, // Uranus, Neptuneです。 // planet1とplanet2という2つの惑星名を文字列として受け取る関数を作成してください。 // この関数は、planet1の軌道とplanet2の軌道の間に位置するすべての惑星を太陽に近い順に並べたタプルを返すべきです。 // planet1またはplanet2が正確な惑星名でない場合、関数は空のタプルを返すべきです。 // 例 // >>> bf("Jupiter", "Neptune") // []interface{}{"Saturn", "Uranus"} // >>> bf("Earth", "Mercury") // "Venus" // >>> bf("Mercury", "Uranus") // []interface{}{"Venus", "Earth", "Mars", "Jupiter", "Saturn"} func bf(planet1 string, planet2 string) []interface{} {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py
reworded
func TestBf(t *testing.T) { candidate := bf type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("Jupiter", "Neptune"), expected: []interface{}{"Saturn", "Uranus"} }, { actual: candidate("Earth", "Mercury"), expected: []interface{}{"Venus"} }, { actual: candidate("Mercury", "Uranus"), expected: []interface{}{"Venus", "Earth", "Mars", "Jupiter", "Saturn"} }, { actual: candidate("Neptune", "Venus"), expected: []interface{}{"Earth", "Mars", "Jupiter", "Saturn", "Uranus"} }, { actual: candidate("Earth", "Earth"), expected: []interface{}{} }, { actual: candidate("Mars", "Earth"), expected: []interface{}{} }, { actual: candidate("Jupiter", "Makemake"), expected: []interface{}{} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_149_sorted_list_sum
go_test.go
package sorted_list_sum_test import ( "testing" "fmt" ) // 文字列のリストを引数として受け取る関数を作成してください。 // この関数は、リストから奇数の長さを持つ文字列を削除し、 // 結果として得られるリストを長さで昇順に並べ替えて返します。 // リストは常に文字列のリストであり、数字の配列ではありません。 // また、重複する文字列が含まれる可能性があります。 // リストは各単語の長さで昇順に並べられるべきで、そのルールに従ってソートされたリストを返してください。 // もし二つの単語が同じ長さであれば、リストをアルファベット順に並べ替えてください。 // 関数はソートされた順序で文字列のリストを返すべきです。 // すべての単語が同じ長さを持つと仮定しても構いません。 // 例えば: // >>> list_sort([]string{"aa", "a", "aaa"}) // []string{"aa"} // >>> list_sort([]string{"ab", "a", "aaa", "cd"}) // []string{"ab", "cd"} func sorted_list_sum(lst []string) []string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py
reworded
func TestSorted_List_Sum(t *testing.T) { candidate := sorted_list_sum type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]string{"aa", "a", "aaa"}), expected: []string{"aa"} }, { actual: candidate([]string{"school", "AI", "asdf", "b"}), expected: []string{"AI", "asdf", "school"} }, { actual: candidate([]string{"d", "b", "c", "a"}), expected: []string{} }, { actual: candidate([]string{"d", "dcba", "abcd", "a"}), expected: []string{"abcd", "dcba"} }, { actual: candidate([]string{"AI", "ai", "au"}), expected: []string{"AI", "ai", "au"} }, { actual: candidate([]string{"a", "b", "b", "c", "c", "a"}), expected: []string{} }, { actual: candidate([]string{"aaaa", "bbbb", "dd", "cc"}), expected: []string{"cc", "dd", "aaaa", "bbbb"} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_150_x_or_y
go_test.go
package x_or_y_test import ( "testing" "fmt" ) // 素数である場合はxの値を返し、それ以外の場合はyの値を返す簡単なプログラム。 // 例: // >>> x_or_y(7, 34, 12) // 34 // >>> x_or_y(15, 8, 5) // 5 func x_or_y(n int, x int, y int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py
reworded
func TestX_Or_Y(t *testing.T) { candidate := x_or_y type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(7, 34, 12), expected: 34 }, { actual: candidate(15, 8, 5), expected: 5 }, { actual: candidate(3, 33, 5212), expected: 33 }, { actual: candidate(1259, 3, 52), expected: 3 }, { actual: candidate(7919, -1, 12), expected: -1 }, { actual: candidate(3609, 1245, 583), expected: 583 }, { actual: candidate(91, 56, 129), expected: 129 }, { actual: candidate(6, 34, 1234), expected: 1234 }, { actual: candidate(1, 2, 0), expected: 0 }, { actual: candidate(2, 2, 0), expected: 2 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_151_double_the_difference
go_test.go
package double_the_difference_test import ( "testing" "fmt" ) // 数字のリストが与えられた場合、そのリスト内の奇数の数値の二乗の合計を返してください。 // 負の数や整数でない数は無視してください。 // >>> double_the_difference([]int{1, 3, 2, 0}) // 10 // >>> double_the_difference([]int{-1, -2, 0}) // 0 // >>> double_the_difference([]int{9, -2}) // 81 // >>> double_the_difference([]int{0}) // 0 // 入力リストが空の場合は0を返すようにしてください。 func double_the_difference(lst []float64) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py
reworded
func TestDouble_The_Difference(t *testing.T) { candidate := double_the_difference type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]float64{}), expected: 0 }, { actual: candidate([]float64{5.0, 4.0}), expected: 25 }, { actual: candidate([]float64{0.1, 0.2, 0.3}), expected: 0 }, { actual: candidate([]float64{-10.0, -20.0, -30.0}), expected: 0 }, { actual: candidate([]float64{-1.0, -2.0, 8.0}), expected: 0 }, { actual: candidate([]float64{0.2, 3.0, 5.0}), expected: 34 }, { actual: candidate([]float64{-9.0, -7.0, -5.0, -3.0, -1.0, 1.0, 3.0, 5.0, 7.0, 9.0}), expected: 165 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_152_compare
go_test.go
package compare_test import ( "testing" "fmt" ) // 待ち望んでいた出来事の結果がようやく判明したときの感覚は、誰もが覚えていると思う。 // その瞬間に抱いた感情や思考は、間違いなくメモして比較する価値がある。 // あなたの仕事は、人がいくつかの試合の結果を正確に予想したかどうかを判断することです。 // スコアと予想の2つの配列が等しい長さで与えられます。各インデックスは1つの試合を示しています。 // 各予想がどれだけ外れていたかを示す同じ長さの配列を返してください。予想が正確であれば、 // その値は0です。そうでなければ、その値は予想とスコアの絶対的な差です。 // 例: // >>> compare([]int{1, 2, 3, 4, 5, 1}, []int{1, 2, 3, 4, 2, -2}) // []int{0, 0, 0, 0, 3, 3} // >>> compare([]int{0, 5, 0, 0, 0, 4}, []int{4, 1, 1, 0, 0, -2}) // []int{4, 4, 1, 0, 0, 6} func compare(game []int, guess []int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py
reworded
func TestCompare(t *testing.T) { candidate := compare type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]int{1, 2, 3, 4, 5, 1}, []int{1, 2, 3, 4, 2, -2}), expected: []int{0, 0, 0, 0, 3, 3} }, { actual: candidate([]int{0, 0, 0, 0, 0, 0}, []int{0, 0, 0, 0, 0, 0}), expected: []int{0, 0, 0, 0, 0, 0} }, { actual: candidate([]int{1, 2, 3}, []int{-1, -2, -3}), expected: []int{2, 4, 6} }, { actual: candidate([]int{1, 2, 3, 5}, []int{-1, 2, 3, 4}), expected: []int{2, 0, 0, 1} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_153_Strongest_Extension
go_test.go
package Strongest_Extension_test import ( "testing" "fmt" ) // クラスの名前(文字列)と拡張子のリストが与えられます。 // この拡張子は、指定されたクラスに追加のクラスをロードするために使用されます。 // 拡張子の強度は次のように計算されます:CAPは拡張子の名前に含まれる // 大文字の数、SMは小文字の数です。強度は、CAP - SM で与えられます。 // 最も強い拡張子を見つけて、この形式の文字列を返してください:ClassName.StrongestExtensionName。 // 同じ強度を持つ2つ以上の拡張子がある場合は、リストで最初に来るものを選びます。 // 例えば、"Slices"というクラスと、拡張子のリスト['SErviNGSliCes', 'Cheese', 'StuFfed'] が与えられた場合、' // SErviNGSliCes'が最も強い拡張子(強度は-1)となるため、'Slices.SErviNGSliCes'を返すべきです。 // 例: // >>> Strongest_Extension("my_class", []string{"AA", "Be", "CC"}) // "my_class.AA" func Strongest_Extension(class_name string, extensions []string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py
reworded
func TestStrongest_Extension(t *testing.T) { candidate := Strongest_Extension type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("Watashi", []string{"tEN", "niNE", "eIGHt8OKe"}), expected: "Watashi.eIGHt8OKe" }, { actual: candidate("Boku123", []string{"nani", "NazeDa", "YEs.WeCaNe", "32145tggg"}), expected: "Boku123.YEs.WeCaNe" }, { actual: candidate("__YESIMHERE", []string{"t", "eMptY", "nothing", "zeR00", "NuLl__", "123NoooneB321"}), expected: "__YESIMHERE.NuLl__" }, { actual: candidate("K", []string{"Ta", "TAR", "t234An", "cosSo"}), expected: "K.TAR" }, { actual: candidate("__HAHA", []string{"Tab", "123", "781345", "-_-"}), expected: "__HAHA.123" }, { actual: candidate("YameRore", []string{"HhAas", "okIWILL123", "WorkOut", "Fails", "-_-"}), expected: "YameRore.okIWILL123" }, { actual: candidate("finNNalLLly", []string{"Die", "NowW", "Wow", "WoW"}), expected: "finNNalLLly.WoW" }, { actual: candidate("_", []string{"Bb", "91245"}), expected: "_.Bb" }, { actual: candidate("Sp", []string{"671235", "Bb"}), expected: "Sp.671235" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_154_cycpattern_check
go_test.go
package cycpattern_check_test import ( "testing" "fmt" ) // 2つの単語が与えられる。2番目の単語またはその回転させた文字列が最初の単語の部分文字列である場合、trueを返す必要がある。 // >>> cycpattern_check("abcd", "abd") // false // >>> cycpattern_check("hello", "ell") // true // >>> cycpattern_check("whassup", "psus") // false // >>> cycpattern_check("abab", "baa") // true // >>> cycpattern_check("efef", "eeff") // false // >>> cycpattern_check("himenss", "simen") // true func cycpattern_check(a string, b string) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py
reworded
func TestCycpattern_Check(t *testing.T) { candidate := cycpattern_check type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("xyzw", "xyw"), expected: false }, { actual: candidate("yello", "ell"), expected: true }, { actual: candidate("whattup", "ptut"), expected: false }, { actual: candidate("efef", "fee"), expected: true }, { actual: candidate("abab", "aabb"), expected: false }, { actual: candidate("winemtt", "tinem"), expected: true }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_155_even_odd_count
go_test.go
package even_odd_count_test import ( "testing" "fmt" ) // 整数が与えられた場合、偶数桁数と奇数桁数をそれぞれ持つタプルを返す。 // 例: // >>> even_odd_count(-12) // []interface{}{1, 1} // >>> even_odd_count(123) // []interface{}{1, 2} func even_odd_count(num int) []interface{} {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py
reworded
func TestEven_Odd_Count(t *testing.T) { candidate := even_odd_count type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(7), expected: []interface{}{0, 1} }, { actual: candidate(-78), expected: []interface{}{1, 1} }, { actual: candidate(3452), expected: []interface{}{2, 2} }, { actual: candidate(346211), expected: []interface{}{3, 3} }, { actual: candidate(-345821), expected: []interface{}{3, 3} }, { actual: candidate(-2), expected: []interface{}{1, 0} }, { actual: candidate(-45347), expected: []interface{}{2, 3} }, { actual: candidate(0), expected: []interface{}{1, 0} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_156_int_to_mini_roman
go_test.go
package int_to_mini_roman_test import ( "testing" "fmt" ) // 正の整数が与えられたとき、ローマ数字に相当する文字列を小文字で返す。 // 制限事項1 <= num <= 1000 // 例: // >>> int_to_mini_roman(19) // "xix" // >>> int_to_mini_roman(152) // "clii" // >>> int_to_mini_roman(426) // "cdxxvi" func int_to_mini_roman(number int) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py
reworded
func TestInt_To_Mini_Roman(t *testing.T) { candidate := int_to_mini_roman type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(19), expected: "xix" }, { actual: candidate(152), expected: "clii" }, { actual: candidate(251), expected: "ccli" }, { actual: candidate(426), expected: "cdxxvi" }, { actual: candidate(500), expected: "d" }, { actual: candidate(1), expected: "i" }, { actual: candidate(4), expected: "iv" }, { actual: candidate(43), expected: "xliii" }, { actual: candidate(90), expected: "xc" }, { actual: candidate(94), expected: "xciv" }, { actual: candidate(532), expected: "dxxxii" }, { actual: candidate(900), expected: "cm" }, { actual: candidate(994), expected: "cmxciv" }, { actual: candidate(1000), expected: "m" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_157_right_angle_triangle
go_test.go
package right_angle_triangle_test import ( "testing" "fmt" ) // 三角形の3辺の長さを与える。三角形が直角三角形ならtrueを、そうでなければfalseを返す。 // 直角三角形とは、1つの角が直角または90度である三角形のことである。 // 例: // >>> right_angle_triangle(3, 4, 5) // true // >>> right_angle_triangle(1, 2, 3) // false func right_angle_triangle(a int, b int, c int) bool {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py
reworded
func TestRight_Angle_Triangle(t *testing.T) { candidate := right_angle_triangle type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(3, 4, 5), expected: true }, { actual: candidate(1, 2, 3), expected: false }, { actual: candidate(10, 6, 8), expected: true }, { actual: candidate(2, 2, 2), expected: false }, { actual: candidate(7, 24, 25), expected: true }, { actual: candidate(10, 5, 7), expected: false }, { actual: candidate(5, 12, 13), expected: true }, { actual: candidate(15, 8, 17), expected: true }, { actual: candidate(48, 55, 73), expected: true }, { actual: candidate(1, 1, 1), expected: false }, { actual: candidate(2, 2, 10), expected: false }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_158_find_max
go_test.go
package find_max_test import ( "testing" "fmt" ) // 文字列のリストを受け取る関数を書きなさい。 // リストは異なる単語を含む。異なる固有の文字数が最も多い単語を返す。 // 複数の文字列が同じ文字数を持つ場合は、辞書順で最初に来るものを返すことにする。 // >>> find_max([]string{"name", "of", "string"}) // "string" // >>> find_max([]string{"name", "enam", "game"}) // "enam" // >>> find_max([]string{"aaaaaaa", "bb", "cc"}) // "aaaaaaa" func find_max(words []string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py
reworded
func TestFind_Max(t *testing.T) { candidate := find_max type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]string{"name", "of", "string"}), expected: "string" }, { actual: candidate([]string{"name", "enam", "game"}), expected: "enam" }, { actual: candidate([]string{"aaaaaaa", "bb", "cc"}), expected: "aaaaaaa" }, { actual: candidate([]string{"abc", "cba"}), expected: "abc" }, { actual: candidate([]string{"play", "this", "game", "of", "footbott"}), expected: "footbott" }, { actual: candidate([]string{"we", "are", "gonna", "rock"}), expected: "gonna" }, { actual: candidate([]string{"we", "are", "a", "mad", "nation"}), expected: "nation" }, { actual: candidate([]string{"this", "is", "a", "prrk"}), expected: "this" }, { actual: candidate([]string{"b"}), expected: "b" }, { actual: candidate([]string{"play", "play", "play"}), expected: "play" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_159_eat
go_test.go
package eat_test import ( "testing" "fmt" ) // あなたはお腹を空かせたウサギです。すでに一定数のニンジンを食べました。 // これからさらにニンジンを食べなければその日の食事は完了しません。 // あなたは [ 食事の後に食べたニンジンの総数, 食事の後に残ったニンジンの数 ] の配列を返してください。 // もし残りのニンジンが十分でなければ、あなたは残りのニンジンをすべて食べますが、まだお腹が空いています。 // 例: // >>> eat(5, 6, 10) // []int{11, 4} // >>> eat(4, 8, 9) // []int{12, 1} // >>> eat(1, 10, 10) // []int{11, 0} // >>> eat(2, 11, 5) // []int{7, 0} // 変数: // @number : 整数 // 食べたニンジンの数。 // @need : 整数 // にんじんを何本食べるか。 // @remaining : 整数 // 残りのニンジンの在庫数 // 制約: // * 0 <= number <= 1000 // * 0 <= need <= 1000 // * 0 <= remaining <= 1000 // 楽しんで :) func eat(number int, need int, remaining int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py
reworded
func TestEat(t *testing.T) { candidate := eat type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(5, 6, 10), expected: []int{11, 4} }, { actual: candidate(4, 8, 9), expected: []int{12, 1} }, { actual: candidate(1, 10, 10), expected: []int{11, 0} }, { actual: candidate(2, 11, 5), expected: []int{7, 0} }, { actual: candidate(4, 5, 7), expected: []int{9, 2} }, { actual: candidate(4, 5, 1), expected: []int{5, 0} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_160_do_algebra
go_test.go
package do_algebra_test import ( "testing" "fmt" ) // 演算子(operator)とオペランド(operand)の2つのリストが与えられる。ひとつ目のリストは // 基本的な算術演算を持ち、二つ目のリストは整数のリストである。与えられた2つのリストを // 使って算術式を構築し、その評価結果を返そう。 // 基本的な算術演算: // 加算 ( + ) // 減算 ( - ) // 乗算 ( * ) // 階除算 ( // ) // 指数化 ( ** ) // 例: // operator['+', '*', '-'] // list = [2, 3, 4, 5] // result = 2 + 3 * 4 - 5 // => result = 9 // 注:演算子のリストの長さは、オペランドのリストの長さから1を引いた長さに等しい。 // オペランドは非負整数のリストである。 // operator は少なくとも1つの演算子を持ち、operand は少なくとも2つのオペランドを持つ。 func do_algebra(operator []string, operand []int) int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py
reworded
func TestDo_Algebra(t *testing.T) { candidate := do_algebra type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate([]string{"**", "*", "+"}, []int{2, 3, 4, 5}), expected: 37 }, { actual: candidate([]string{"+", "*", "-"}, []int{2, 3, 4, 5}), expected: 9 }, { actual: candidate([]string{"//", "*"}, []int{7, 3, 4}), expected: 8 }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_161_solve
go_test.go
package solve_test import ( "testing" "fmt" ) // 文字列sが与えられます。 // もしs[i]がアルファベットなら、その文字の大文字と小文字を反転させる。そうでない場合は、そのままにしておく。 // もし文字列にアルファベットが一つも含まれていない場合は、文字列全体を逆順にする。 // 関数は結果の文字列を返すようにします。 // 例 // >>> solve("1234") // "4321" // >>> solve("ab") // "AB" // >>> solve("#a@C") // "#A@c" func solve(s string) string {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py
reworded
func TestSolve(t *testing.T) { candidate := solve type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate("AsDf"), expected: "aSdF" }, { actual: candidate("1234"), expected: "4321" }, { actual: candidate("ab"), expected: "AB" }, { actual: candidate("#a@C"), expected: "#A@c" }, { actual: candidate("#AsdfW^45"), expected: "#aSDFw^45" }, { actual: candidate("#6@2"), expected: "2@6#" }, { actual: candidate("#$a^D"), expected: "#$A^d" }, { actual: candidate("#ccc"), expected: "#CCC" }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]
HumanEval_163_generate_integers
go_test.go
package generate_integers_test import ( "testing" "fmt" ) // 正の整数aとbが与えられたとき、aとbの間にある偶数の数字を昇順で返してください。 // 例えば: // >>> generate_integers(2, 8) // []int{2, 4, 6, 8} // >>> generate_integers(8, 2) // []int{2, 4, 6, 8} // >>> generate_integers(10, 14) // []int{} func generate_integers(a int, b int) []int {
transform
/work/arjunguha-research-group/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py
reworded
func TestGenerate_Integers(t *testing.T) { candidate := generate_integers type test struct { actual interface{} expected interface{} } tests := []test{ { actual: candidate(2, 10), expected: []int{2, 4, 6, 8} }, { actual: candidate(10, 2), expected: []int{2, 4, 6, 8} }, { actual: candidate(132, 2), expected: []int{2, 4, 6, 8} }, { actual: candidate(17, 89), expected: []int{} }, } for i, tc := range tests { t.Run(fmt.Sprintf("test num % d", i), func(t *testing.T) { if fmt.Sprintf("%v", tc.actual) != fmt.Sprintf("%v", tc.expected) { t.Errorf("expected '%s', got '%s'", tc.expected, tc.actual) } }) } }
[ "\nfunc", "struct", "\n// " ]