Datasets:

Languages:
code
ArXiv:
Tags:
code
License:
Muennighoff commited on
Commit
ede531c
·
1 Parent(s): ca63504
Files changed (1) hide show
  1. data/go/data/humanevalbugs.jsonl +1 -1
data/go/data/humanevalbugs.jsonl CHANGED
@@ -48,7 +48,7 @@
48
  {"task_id": "Go/47", "prompt": "import (\n\t\"sort\"\n)\n\n// Return Median of elements in the list l.\n// >>> Median([3, 1, 2, 4, 5])\n// 3.0\n// >>> Median([-10, 4, 6, 1000, 10, 20])\n// 15.0\nfunc Median(l []int) float64 {\n", "import": "import (\n\t\"sort\"\n)", "docstring": "// Return Median of elements in the list l.\n// >>> Median([3, 1, 2, 4, 5])\n// 3\n// >>> Median([-10, 4, 6, 1000, 10, 20])\n// 15.0\n", "declaration": "\nfunc Median(l []int) float64 {\n", "canonical_solution": " sort.Ints(l)\n\tif len(l)%2==1{\n\t\treturn float64(l[len(l)/2])\n\t}else{\n\t\treturn float64(l[len(l)/2-1]+l[len(l)/2])/2.0\n\t}\n}\n\n", "test": "func TestMedian(t *testing.T) {\n\tassert := assert.New(t)\n\tassert.Equal(3.0, Median([]int{3, 1, 2, 4, 5}))\n\tassert.Equal(8.0, Median([]int{-10, 4, 6, 1000, 10, 20}))\n\tassert.Equal(5.0, Median([]int{5}))\n\tassert.Equal(5.5, Median([]int{6, 5}))\n\tassert.Equal(7.0, Median([]int{8, 1, 3, 9, 9, 2, 7}))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestMedian(t *testing.T) {\n\tassert := assert.New(t)\n\tassert.Equal(3.0, Median([]int{3, 1, 2, 4, 5}))\n\tassert.Equal(8.0, Median([]int{-10, 4, 6, 1000, 10, 20}))\n}\n", "buggy_solution": " sort.Ints(l)\n\tif len(l)%2==1{\n\t\treturn float64(l[len(l)/2])\n\t}else{\n\t\treturn float64(l[len(l)-1/2]+l[len(l)/2])/2.0\n\t}\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "Median"}
49
  {"task_id": "Go/48", "prompt": "\n// Checks if given string is a palindrome\n// >>> IsPalindrome('')\n// true\n// >>> IsPalindrome('aba')\n// true\n// >>> IsPalindrome('aaaaa')\n// true\n// >>> IsPalindrome('zbcd')\n// false\nfunc IsPalindrome(text string) bool {\n", "import": "", "docstring": "// Checks if given string is a palindrome\n// >>> IsPalindrome('')\n// true\n// >>> IsPalindrome('aba')\n// true\n// >>> IsPalindrome('aaaaa')\n// true\n// >>> IsPalindrome('zbcd')\n// false\n", "declaration": "\nfunc IsPalindrome(text string) bool {\n", "canonical_solution": " runes := []rune(text)\n result := make([]rune, 0)\n for i := len(runes) - 1; i >= 0; i-- {\n result = append(result, runes[i])\n }\n return text == string(result)\n}\n\n", "test": "func TestIsPalindrome(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, IsPalindrome(\"\"))\n assert.Equal(true, IsPalindrome(\"aba\"))\n assert.Equal(true, IsPalindrome(\"aaaaa\"))\n assert.Equal(false, IsPalindrome(\"zbcd\"))\n assert.Equal(true, IsPalindrome(\"xywyx\"))\n assert.Equal(false, IsPalindrome(\"xywyz\"))\n assert.Equal(false, IsPalindrome(\"xywzx\"))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestIsPalindrome(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, IsPalindrome(\"\"))\n assert.Equal(true, IsPalindrome(\"aba\"))\n assert.Equal(true, IsPalindrome(\"aaaaa\"))\n assert.Equal(false, IsPalindrome(\"zbcd\"))\n}\n", "buggy_solution": " runes := []rune(text)\n result := make([]rune, 0)\n for i := len(runes) - 1; i > 0; i-- {\n result = append(result, runes[i])\n }\n return text == string(result)\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "IsPalindrome"}
50
  {"task_id": "Go/49", "prompt": "\n// Return 2^n modulo p (be aware of numerics).\n// >>> Modp(3, 5)\n// 3\n// >>> Modp(1101, 101)\n// 2\n// >>> Modp(0, 101)\n// 1\n// >>> Modp(3, 11)\n// 8\n// >>> Modp(100, 101)\n// 1\nfunc Modp(n int,p int) int {\n", "import": "", "docstring": "// Return 2^n modulo p (be aware of numerics).\n// >>> Modp(3, 5)\n// 3\n// >>> Modp(1101, 101)\n// 2\n// >>> Modp(0, 101)\n// 1\n// >>> Modp(3, 11)\n// 8\n// >>> Modp(100, 101)\n// 1\n", "declaration": "\nfunc Modp(n int,p int) int {\n", "canonical_solution": " ret := 1\n for i:= 0; i < n; i++ {\n\t\tret = (2 * ret) % p\n\t}\n return ret\n}\n\n", "test": "func TestModp(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(3, Modp(3, 5))\n assert.Equal(2, Modp(1101, 101))\n assert.Equal(1, Modp(0, 101))\n assert.Equal(8, Modp(3, 11))\n assert.Equal(1, Modp(100, 101))\n assert.Equal(4, Modp(30, 5))\n assert.Equal(3, Modp(31, 5))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestModp(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(3, Modp(3, 5))\n assert.Equal(2, Modp(1101, 101))\n assert.Equal(1, Modp(0, 101))\n assert.Equal(8, Modp(3, 11))\n assert.Equal(1, Modp(100, 101))\n}\n", "buggy_solution": " ret := 0\n for i:= 0; i < n; i++ {\n\t\tret = (2 * ret) % p\n\t}\n return ret\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "Modp"}
51
- {"task_id": "Go/50", "prompt": "// returns encoded string by shifting every character by 5 in the alphabet.\nfunc EncodeShift(s string) string {\n runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch+5-'a')%26+'a')\n }\n return string(runes)\n}\n\n// takes as input string encoded with EncodeShift function. Returns decoded string.\nfunc DecodeShift(s string) string {\n", "import": "", "docstring": "// returns encoded string by shifting every character by 5 in the alphabet.\n// takes as input string encoded with encode_shift function. Returns decoded string.\n", "declaration": "\nfunc DecodeShift(s string) string {\n", "canonical_solution": " runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch-5-'a')%26+'a')\n }\n return string(runes)\n}\n\n", "test": "func TestDecodeShift(t *testing.T) {\n assert := assert.New(t)\n randInt := func(min, max int) int {\n rng := rand.New(rand.NewSource(time.Now().UnixNano()))\n if min >= max || min == 0 || max == 0 {\n return max\n }\n return rng.Intn(max-min) + min\n }\n for i := 0; i <100 ; i++ {\n runes := make([]rune, 0)\n for j := 0; j < randInt(10,20); j++ {\n runes = append(runes, int32(randInt('a','z')))\n }\n encoded_str := EncodeShift(string(runes))\n assert.Equal(DecodeShift(encoded_str), string(runes))\n }\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"math/rand\"\n \"time\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "", "buggy_solution": " runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch-5-'a')%26+'a')\n }\n return EncodeShift(string(runes))\n}\n\n", "bug_type": "variable misuse", "failure_symptoms": "incorrect output", "entry_point": "DecodeShift"}
52
  {"task_id": "Go/51", "prompt": "import (\n \"regexp\"\n)\n\n// RemoveVowels is a function that takes string and returns string without vowels.\n// >>> RemoveVowels('')\n// ''\n// >>> RemoveVowels(\"abcdef\\nghijklm\")\n// 'bcdf\\nghjklm'\n// >>> RemoveVowels('abcdef')\n// 'bcdf'\n// >>> RemoveVowels('aaaaa')\n// ''\n// >>> RemoveVowels('aaBAA')\n// 'B'\n// >>> RemoveVowels('zbcd')\n// 'zbcd'\nfunc RemoveVowels(text string) string {\n", "import": "import (\n \"regexp\"\n)", "docstring": "// RemoveVowels is a function that takes string and returns string without vowels.\n// >>> RemoveVowels('')\n// ''\n// >>> RemoveVowels(\"abcdef\\nghijklm\")\n// 'bcdf\\nghjklm'\n// >>> RemoveVowels('abcdef')\n// 'bcdf'\n// >>> RemoveVowels('aaaaa')\n// ''\n// >>> RemoveVowels('aaBAA')\n// 'B'\n// >>> RemoveVowels('zbcd')\n// 'zbcd'\n", "declaration": "\nfunc RemoveVowels(text string) string {\n ", "canonical_solution": " var re = regexp.MustCompile(\"[aeiouAEIOU]\")\n\ttext = re.ReplaceAllString(text, \"\")\n\treturn text\n}\n\n", "test": "func TestRemoveVowels(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(\"\", RemoveVowels(\"\"))\n assert.Equal(\"bcdf\\nghjklm\", RemoveVowels(\"abcdef\\nghijklm\"))\n assert.Equal(\"fdcb\", RemoveVowels(\"fedcba\"))\n assert.Equal(\"\", RemoveVowels(\"eeeee\"))\n assert.Equal(\"cB\", RemoveVowels(\"acBAA\"))\n assert.Equal(\"cB\", RemoveVowels(\"EcBOO\"))\n assert.Equal(\"ybcd\", RemoveVowels(\"ybcd\"))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestRemoveVowels(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(\"\", RemoveVowels(\"\"))\n assert.Equal(\"bcdf\\nghjklm\", RemoveVowels(\"abcdef\\nghijklm\"))\n assert.Equal(\"bcdf\", RemoveVowels(\"abcdef\"))\n assert.Equal(\"\", RemoveVowels(\"aaaaa\"))\n assert.Equal(\"B\", RemoveVowels(\"aaBAA\"))\n assert.Equal(\"zbcd\", RemoveVowels(\"zbcd\"))\n}\n", "buggy_solution": " var re = regexp.MustCompile(\"[aeiouwyAEIOUWY]\")\n\ttext = re.ReplaceAllString(text, \"\")\n\treturn text\n}\n\n", "bug_type": "excess logic", "failure_symptoms": "incorrect output", "entry_point": "RemoveVowels"}
53
  {"task_id": "Go/52", "prompt": "\n// Return true if all numbers in the list l are below threshold t.\n// >>> BelowThreshold([1, 2, 4, 10], 100)\n// true\n// >>> BelowThreshold([1, 20, 4, 10], 5)\n// false\nfunc BelowThreshold(l []int,t int) bool {\n", "import": "", "docstring": "// Return true if all numbers in the list l are below threshold t.\n// >>> BelowThreshold([1, 2, 4, 10], 100)\n// true\n// >>> BelowThreshold([1, 20, 4, 10], 5)\n// false\n", "declaration": "\nfunc BelowThreshold(l []int,t int) bool {\n", "canonical_solution": " for _, n := range l {\n\t\tif n >= t {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n", "test": "func TestBelowThreshold(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, BelowThreshold([]int{1, 2, 4, 10}, 100))\n assert.Equal(false, BelowThreshold([]int{1, 20, 4, 10}, 5))\n assert.Equal(true, BelowThreshold([]int{1, 20, 4, 10}, 21))\n assert.Equal(true, BelowThreshold([]int{1, 20, 4, 10}, 22))\n assert.Equal(true, BelowThreshold([]int{1, 8, 4, 10}, 11))\n assert.Equal(false, BelowThreshold([]int{1, 8, 4, 10}, 10))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestBelowThreshold(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, BelowThreshold([]int{1, 2, 4, 10}, 100))\n assert.Equal(false, BelowThreshold([]int{1, 20, 4, 10}, 5))\n}\n", "buggy_solution": " for _, n := range l {\n\t\tif n >= t {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n", "bug_type": "operator misuse", "failure_symptoms": "incorrect output", "entry_point": "BelowThreshold"}
54
  {"task_id": "Go/53", "prompt": "\n// Add two numbers x and y\n// >>> Add(2, 3)\n// 5\n// >>> Add(5, 7)\n// 12\nfunc Add(x int, y int) int {\n", "import": "", "docstring": "// Add two numbers x and y\n// >>> Add(2, 3)\n// 5\n// >>> Add(5, 7)\n// 12\n", "declaration": "\nfunc Add(x int, y int) int {\n", "canonical_solution": " return x + y\n}\n\n", "test": "func TestAdd(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(1, Add(0, 1))\n assert.Equal(1, Add(1, 0))\n assert.Equal(5, Add(2, 3))\n assert.Equal(12, Add(5, 7))\n assert.Equal(12, Add(7, 5))\n for i := 0; i < 100; i++ {\n x := rand.Int31n(1000)\n y := rand.Int31n(1000)\n assert.Equal(int(x+y), Add(int(x), int(y)))\n }\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"math/rand\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestAdd(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(5, Add(2, 3+rand.Intn(1000)*0))\n assert.Equal(12, Add(5, 7))\n}\n", "buggy_solution": " return x + y + y + x\n}\n\n", "bug_type": "excess logic", "failure_symptoms": "incorrect output", "entry_point": "Add"}
 
48
  {"task_id": "Go/47", "prompt": "import (\n\t\"sort\"\n)\n\n// Return Median of elements in the list l.\n// >>> Median([3, 1, 2, 4, 5])\n// 3.0\n// >>> Median([-10, 4, 6, 1000, 10, 20])\n// 15.0\nfunc Median(l []int) float64 {\n", "import": "import (\n\t\"sort\"\n)", "docstring": "// Return Median of elements in the list l.\n// >>> Median([3, 1, 2, 4, 5])\n// 3\n// >>> Median([-10, 4, 6, 1000, 10, 20])\n// 15.0\n", "declaration": "\nfunc Median(l []int) float64 {\n", "canonical_solution": " sort.Ints(l)\n\tif len(l)%2==1{\n\t\treturn float64(l[len(l)/2])\n\t}else{\n\t\treturn float64(l[len(l)/2-1]+l[len(l)/2])/2.0\n\t}\n}\n\n", "test": "func TestMedian(t *testing.T) {\n\tassert := assert.New(t)\n\tassert.Equal(3.0, Median([]int{3, 1, 2, 4, 5}))\n\tassert.Equal(8.0, Median([]int{-10, 4, 6, 1000, 10, 20}))\n\tassert.Equal(5.0, Median([]int{5}))\n\tassert.Equal(5.5, Median([]int{6, 5}))\n\tassert.Equal(7.0, Median([]int{8, 1, 3, 9, 9, 2, 7}))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestMedian(t *testing.T) {\n\tassert := assert.New(t)\n\tassert.Equal(3.0, Median([]int{3, 1, 2, 4, 5}))\n\tassert.Equal(8.0, Median([]int{-10, 4, 6, 1000, 10, 20}))\n}\n", "buggy_solution": " sort.Ints(l)\n\tif len(l)%2==1{\n\t\treturn float64(l[len(l)/2])\n\t}else{\n\t\treturn float64(l[len(l)-1/2]+l[len(l)/2])/2.0\n\t}\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "Median"}
49
  {"task_id": "Go/48", "prompt": "\n// Checks if given string is a palindrome\n// >>> IsPalindrome('')\n// true\n// >>> IsPalindrome('aba')\n// true\n// >>> IsPalindrome('aaaaa')\n// true\n// >>> IsPalindrome('zbcd')\n// false\nfunc IsPalindrome(text string) bool {\n", "import": "", "docstring": "// Checks if given string is a palindrome\n// >>> IsPalindrome('')\n// true\n// >>> IsPalindrome('aba')\n// true\n// >>> IsPalindrome('aaaaa')\n// true\n// >>> IsPalindrome('zbcd')\n// false\n", "declaration": "\nfunc IsPalindrome(text string) bool {\n", "canonical_solution": " runes := []rune(text)\n result := make([]rune, 0)\n for i := len(runes) - 1; i >= 0; i-- {\n result = append(result, runes[i])\n }\n return text == string(result)\n}\n\n", "test": "func TestIsPalindrome(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, IsPalindrome(\"\"))\n assert.Equal(true, IsPalindrome(\"aba\"))\n assert.Equal(true, IsPalindrome(\"aaaaa\"))\n assert.Equal(false, IsPalindrome(\"zbcd\"))\n assert.Equal(true, IsPalindrome(\"xywyx\"))\n assert.Equal(false, IsPalindrome(\"xywyz\"))\n assert.Equal(false, IsPalindrome(\"xywzx\"))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestIsPalindrome(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, IsPalindrome(\"\"))\n assert.Equal(true, IsPalindrome(\"aba\"))\n assert.Equal(true, IsPalindrome(\"aaaaa\"))\n assert.Equal(false, IsPalindrome(\"zbcd\"))\n}\n", "buggy_solution": " runes := []rune(text)\n result := make([]rune, 0)\n for i := len(runes) - 1; i > 0; i-- {\n result = append(result, runes[i])\n }\n return text == string(result)\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "IsPalindrome"}
50
  {"task_id": "Go/49", "prompt": "\n// Return 2^n modulo p (be aware of numerics).\n// >>> Modp(3, 5)\n// 3\n// >>> Modp(1101, 101)\n// 2\n// >>> Modp(0, 101)\n// 1\n// >>> Modp(3, 11)\n// 8\n// >>> Modp(100, 101)\n// 1\nfunc Modp(n int,p int) int {\n", "import": "", "docstring": "// Return 2^n modulo p (be aware of numerics).\n// >>> Modp(3, 5)\n// 3\n// >>> Modp(1101, 101)\n// 2\n// >>> Modp(0, 101)\n// 1\n// >>> Modp(3, 11)\n// 8\n// >>> Modp(100, 101)\n// 1\n", "declaration": "\nfunc Modp(n int,p int) int {\n", "canonical_solution": " ret := 1\n for i:= 0; i < n; i++ {\n\t\tret = (2 * ret) % p\n\t}\n return ret\n}\n\n", "test": "func TestModp(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(3, Modp(3, 5))\n assert.Equal(2, Modp(1101, 101))\n assert.Equal(1, Modp(0, 101))\n assert.Equal(8, Modp(3, 11))\n assert.Equal(1, Modp(100, 101))\n assert.Equal(4, Modp(30, 5))\n assert.Equal(3, Modp(31, 5))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestModp(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(3, Modp(3, 5))\n assert.Equal(2, Modp(1101, 101))\n assert.Equal(1, Modp(0, 101))\n assert.Equal(8, Modp(3, 11))\n assert.Equal(1, Modp(100, 101))\n}\n", "buggy_solution": " ret := 0\n for i:= 0; i < n; i++ {\n\t\tret = (2 * ret) % p\n\t}\n return ret\n}\n\n", "bug_type": "value misuse", "failure_symptoms": "incorrect output", "entry_point": "Modp"}
51
+ {"task_id": "Go/50", "prompt": "// returns encoded string by shifting every character by 5 in the alphabet.\nfunc EncodeShift(s string) string {\n runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch+5-'a')%26+'a')\n }\n return string(runes)\n}\n\n// takes as input string encoded with EncodeShift function. Returns decoded string.\nfunc DecodeShift(s string) string {\n", "import": "", "docstring": "// returns encoded string by shifting every character by 5 in the alphabet.\n// takes as input string encoded with encode_shift function. Returns decoded string.\n", "declaration": "\nfunc DecodeShift(s string) string {\n", "canonical_solution": " runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch-5-'a')%26+'a')\n }\n return string(runes)\n}\n\n", "test": "func TestDecodeShift(t *testing.T) {\n assert := assert.New(t)\n randInt := func(min, max int) int {\n rng := rand.New(rand.NewSource(time.Now().UnixNano()))\n if min >= max || min == 0 || max == 0 {\n return max\n }\n return rng.Intn(max-min) + min\n }\n for i := 0; i <100 ; i++ {\n runes := make([]rune, 0)\n for j := 0; j < randInt(10,20); j++ {\n runes = append(runes, int32(randInt('a','z')))\n }\n encoded_str := EncodeShift(string(runes))\n assert.Equal(DecodeShift(encoded_str), string(runes))\n }\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"math/rand\"\n \"time\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "", "buggy_solution": " runes := []rune(s)\n newRunes := make([]rune, 0)\n for _, ch := range runes {\n newRunes = append(newRunes, (ch-5-'a')%26+'a')\n }\n return DecodeShift(string(runes))\n}\n\n", "bug_type": "variable misuse", "failure_symptoms": "incorrect output", "entry_point": "DecodeShift"}
52
  {"task_id": "Go/51", "prompt": "import (\n \"regexp\"\n)\n\n// RemoveVowels is a function that takes string and returns string without vowels.\n// >>> RemoveVowels('')\n// ''\n// >>> RemoveVowels(\"abcdef\\nghijklm\")\n// 'bcdf\\nghjklm'\n// >>> RemoveVowels('abcdef')\n// 'bcdf'\n// >>> RemoveVowels('aaaaa')\n// ''\n// >>> RemoveVowels('aaBAA')\n// 'B'\n// >>> RemoveVowels('zbcd')\n// 'zbcd'\nfunc RemoveVowels(text string) string {\n", "import": "import (\n \"regexp\"\n)", "docstring": "// RemoveVowels is a function that takes string and returns string without vowels.\n// >>> RemoveVowels('')\n// ''\n// >>> RemoveVowels(\"abcdef\\nghijklm\")\n// 'bcdf\\nghjklm'\n// >>> RemoveVowels('abcdef')\n// 'bcdf'\n// >>> RemoveVowels('aaaaa')\n// ''\n// >>> RemoveVowels('aaBAA')\n// 'B'\n// >>> RemoveVowels('zbcd')\n// 'zbcd'\n", "declaration": "\nfunc RemoveVowels(text string) string {\n ", "canonical_solution": " var re = regexp.MustCompile(\"[aeiouAEIOU]\")\n\ttext = re.ReplaceAllString(text, \"\")\n\treturn text\n}\n\n", "test": "func TestRemoveVowels(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(\"\", RemoveVowels(\"\"))\n assert.Equal(\"bcdf\\nghjklm\", RemoveVowels(\"abcdef\\nghijklm\"))\n assert.Equal(\"fdcb\", RemoveVowels(\"fedcba\"))\n assert.Equal(\"\", RemoveVowels(\"eeeee\"))\n assert.Equal(\"cB\", RemoveVowels(\"acBAA\"))\n assert.Equal(\"cB\", RemoveVowels(\"EcBOO\"))\n assert.Equal(\"ybcd\", RemoveVowels(\"ybcd\"))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestRemoveVowels(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(\"\", RemoveVowels(\"\"))\n assert.Equal(\"bcdf\\nghjklm\", RemoveVowels(\"abcdef\\nghijklm\"))\n assert.Equal(\"bcdf\", RemoveVowels(\"abcdef\"))\n assert.Equal(\"\", RemoveVowels(\"aaaaa\"))\n assert.Equal(\"B\", RemoveVowels(\"aaBAA\"))\n assert.Equal(\"zbcd\", RemoveVowels(\"zbcd\"))\n}\n", "buggy_solution": " var re = regexp.MustCompile(\"[aeiouwyAEIOUWY]\")\n\ttext = re.ReplaceAllString(text, \"\")\n\treturn text\n}\n\n", "bug_type": "excess logic", "failure_symptoms": "incorrect output", "entry_point": "RemoveVowels"}
53
  {"task_id": "Go/52", "prompt": "\n// Return true if all numbers in the list l are below threshold t.\n// >>> BelowThreshold([1, 2, 4, 10], 100)\n// true\n// >>> BelowThreshold([1, 20, 4, 10], 5)\n// false\nfunc BelowThreshold(l []int,t int) bool {\n", "import": "", "docstring": "// Return true if all numbers in the list l are below threshold t.\n// >>> BelowThreshold([1, 2, 4, 10], 100)\n// true\n// >>> BelowThreshold([1, 20, 4, 10], 5)\n// false\n", "declaration": "\nfunc BelowThreshold(l []int,t int) bool {\n", "canonical_solution": " for _, n := range l {\n\t\tif n >= t {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n", "test": "func TestBelowThreshold(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, BelowThreshold([]int{1, 2, 4, 10}, 100))\n assert.Equal(false, BelowThreshold([]int{1, 20, 4, 10}, 5))\n assert.Equal(true, BelowThreshold([]int{1, 20, 4, 10}, 21))\n assert.Equal(true, BelowThreshold([]int{1, 20, 4, 10}, 22))\n assert.Equal(true, BelowThreshold([]int{1, 8, 4, 10}, 11))\n assert.Equal(false, BelowThreshold([]int{1, 8, 4, 10}, 10))\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestBelowThreshold(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(true, BelowThreshold([]int{1, 2, 4, 10}, 100))\n assert.Equal(false, BelowThreshold([]int{1, 20, 4, 10}, 5))\n}\n", "buggy_solution": " for _, n := range l {\n\t\tif n >= t {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n", "bug_type": "operator misuse", "failure_symptoms": "incorrect output", "entry_point": "BelowThreshold"}
54
  {"task_id": "Go/53", "prompt": "\n// Add two numbers x and y\n// >>> Add(2, 3)\n// 5\n// >>> Add(5, 7)\n// 12\nfunc Add(x int, y int) int {\n", "import": "", "docstring": "// Add two numbers x and y\n// >>> Add(2, 3)\n// 5\n// >>> Add(5, 7)\n// 12\n", "declaration": "\nfunc Add(x int, y int) int {\n", "canonical_solution": " return x + y\n}\n\n", "test": "func TestAdd(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(1, Add(0, 1))\n assert.Equal(1, Add(1, 0))\n assert.Equal(5, Add(2, 3))\n assert.Equal(12, Add(5, 7))\n assert.Equal(12, Add(7, 5))\n for i := 0; i < 100; i++ {\n x := rand.Int31n(1000)\n y := rand.Int31n(1000)\n assert.Equal(int(x+y), Add(int(x), int(y)))\n }\n}\n", "test_setup": "package main\n\nimport (\n \"testing\"\n \"math/rand\"\n \"github.com/stretchr/testify/assert\"\n)\n", "example_test": "func TestAdd(t *testing.T) {\n assert := assert.New(t)\n assert.Equal(5, Add(2, 3+rand.Intn(1000)*0))\n assert.Equal(12, Add(5, 7))\n}\n", "buggy_solution": " return x + y + y + x\n}\n\n", "bug_type": "excess logic", "failure_symptoms": "incorrect output", "entry_point": "Add"}