lauraa169 commited on
Commit
a9996a6
·
verified ·
1 Parent(s): 386044f

Upload dataset_base.jsonl with huggingface_hub

Browse files
Files changed (1) hide show
  1. dataset_base.jsonl +31 -31
dataset_base.jsonl CHANGED
@@ -3,8 +3,8 @@
3
  "prompt_nl":"Schrijf een statische methode createScaffold(String rootDir) in Java die een basisprojectstructuur voor Maven creëert. Retourneer ALLEEN de methode.",
4
  "code_snippet_input":"",
5
  "canonical_solution":"public static void createScaffold(String rootDir) throws IOException {\n Path root = Paths.get(rootDir);\n Files.createDirectories(root.resolve(\"src/main/java\"));\n Files.createDirectories(root.resolve(\"src/test/java\"));\n}",
6
- "unit_test_setup": "import org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.io.TempDir;\nimport java.io.IOException;\nimport java.nio.file.*;\nimport static org.junit.jupiter.api.Assertions.*;\npublic class ScaffoldTest {",
7
- "unit_test_assertion":"\n @Test\n public void testDirectoryCreation(@TempDir Path tempDir) throws IOException {\n createScaffold(tempDir.toString());\n assertTrue(Files.exists(tempDir.resolve(\"src/main/java\")), \"src/main/java should exist\");\n assertTrue(Files.exists(tempDir.resolve(\"src/test/java\")), \"src/test/java should exist\");\n assertTrue(Files.isDirectory(tempDir.resolve(\"src/main/java\")), \"Should be a directory\");\n }\n}",
8
  "comment":"the folder structure should contain AT LEAST src/main/java/ and src/test/java/ directories since they're required for every maven project"
9
  }
10
  {"id":"base_java_02","dataset_type":"base","language":"Java","task_category":"elem_func",
@@ -19,35 +19,35 @@
19
  {"id":"base_java_03","dataset_type":"base","language":"Java","task_category":"fix_bug",
20
  "prompt_en":"why am I getting a compilation error in this code? fix it.",
21
  "prompt_nl":"waarom krijg ik een compilatie error in deze code? Los het op.",
22
- "code_snippet_input":"/*Local variable counter defined in an enclosing scope must be final or effectively final*/ \nList<String> results = new ArrayList<>();\nint counter = 0;\nList<String> names = List.of(\"Alice\", \"Bob\", \"Charlie\");\n\nnames.forEach(name -> {\n counter++;\n results.add(counter + \": \" + name);\n});",
23
- "canonical_solution":"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nList<String> results = new ArrayList<>();\nAtomicInteger counter = new AtomicInteger(0);\nList<String> names = List.of(\"Alice\", \"Bob\", \"Charlie\");\n\nnames.forEach(name -> {\n results.add(counter.incrementAndGet() + \": \" + name);\n});",
24
- "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass LambdaTest {\n private List<String> generateResults() {",
25
- "unit_test_assertion":"return results;\n }\n\n @Test\n public void testCounterIncrements() {\n List<String> results = generateResults();\n\n assertEquals(3, results.size(), \"List should contain 3 elements\");\n assertTrue(results.get(0).startsWith(\"1:\"), \"First element must start with 1:\");\n assertTrue(results.get(1).startsWith(\"2:\"), \"Second element must start with 2:\");\n assertTrue(results.get(2).startsWith(\"3:\"), \"Third element must start with 3:\");\n }\n}",
26
  "comment":"counter variable is not final, and cant be changed within the lambda. MUST use an AtomicInteger instead to hold the counter, which allows us to modify its value within the lambda."
27
  }
28
  {"id":"base_java_04","dataset_type":"base","language":"Java","task_category":"fix_bug",
29
  "prompt_en":"why am I getting a compilation error in this code? fix it",
30
  "prompt_nl":"waarom krijg ik een compilatie error in deze code? Los het op.",
31
  "code_snippet_input":"/*name clash: method(List<String>) has the same erasure as method(List<Integer>)*/\npublic String sort(List<String> data) {\n return \"Sorting strings\";\n}\n\npublic String sort(List<Integer> data) {\n return \"Sorting integers\";\n}",
32
- "canonical_solution":" public String sortStrings(List<String> data) {\n return \"Sorting strings\";\n }\n\n public String sortIntegers(List<Integer> data) {\n return \"Sorting integers\";\n }",
33
- "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport static org.junit.jupiter.api.Assertions.*;\n\npublic class Solution {",
34
- "unit_test_assertion":"\n @Test\n public void testMethodsAreDistinct() {\n Solution sol = new Solution();\n String result1 = sol.sortStrings(new ArrayList<String>());\n String result2 = sol.sortIntegers(new ArrayList<Integer>());\n\n assertEquals(\"Sorting strings\", result1);\n assertEquals(\"Sorting integers\", result2);\n }\n}",
35
- "comment":"Java type erasure means List<String> and List<Integer> both become List at runtime, preventing overloading. The solution must rename the methods. Note: Added instantiation of Solution in test to ensure it runs regardless of static/instance context."
36
  }
37
  {"id":"base_java_05","dataset_type":"base","language":"Java","task_category":"fix_bug",
38
  "prompt_en":"why am I getting a compilation error in this code? I want to use the process from printer. Output only the fixed class.",
39
  "prompt_nl":"Waarom krijg ik een compilatiefout in deze code? Ik wil het proces van printer gebruiken. Geef alleen de vaste klasse weer.",
40
- "code_snippet_input":"/*class OfficeMachine inherits unrelated defaults for process() from types Printer and Scanner*/\npublic class OfficeMachine implements Printer, Scanner {\n}",
41
- "canonical_solution":"public class OfficeMachine implements Printer, Scanner {\n @Override\n public String process() {\n return Printer.super.process();\n }\n}",
42
  "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\ninterface Printer {\n default String process() { return \"Printing document...\"; }\n}\n\ninterface Scanner {\n default String process() { return \"Scanning document...\"; }\n}\n",
43
- "unit_test_assertion":"class DiamondProblemTest {\n @Test\n public void testConflictResolution() {\n OfficeMachine machine = new OfficeMachine();\n assertEquals(\"Printing document...\", machine.process(), \"Should return Printer's output\");\n }\n}",
44
  "comment":"the error happens because officemachine implements two methods with the same name from different interfaces. the soluction MUST override the process() method to explicitly call the Printer's default method."
45
  }
46
  {"id":"base_java_06","dataset_type":"base","language":"Java","task_category":"id_bug",
47
  "prompt_en":"why am i getting wrong results in this code? The method doesn't return a list of the transaction in the target currency. Fix the method.",
48
  "prompt_nl":"Waarom krijg ik verkeerde resultaten in deze code? De methode retourneert geen lijst met transacties in de doelvaluta. Corrigeer de methode.",
49
- "code_snippet_input":"public class DataFilter {\n public List<Transaction> filterByCurrency(List<Transaction> data, String targetCurrency) {\n List<Transaction> result = new ArrayList<>();\n for (Transaction t : data) {\n if (t.getCurrency() == targetCurrency) {\n result.add(t);\n }\n }\n return result;\n }\n}",
50
- "canonical_solution":"public class DataFilter {\n public List<Transaction> filterByCurrency(List<Transaction> data, String targetCurrency) {\n List<Transaction> result = new ArrayList<>();\n for (Transaction t : data) {\n if (targetCurrency.equals(t.getCurrency())) {\n result.add(t);\n }\n }\n return result;\n }\n}",
51
  "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass Transaction {\n private String id;\n private String currency;\n public Transaction(String id, String currency) { this.id = id; this.currency = currency; }\n public String getCurrency() { return currency; }\n}",
52
  "unit_test_assertion":"class DataFilterTest {\n @Test\n public void testCurrencyFiltering() {\n DataFilter filter = new DataFilter();\n List<Transaction> dataset = new ArrayList<>();\n\n String dynamicUSD = new String(\"USD\");\n String dynamicEUR = new String(\"EUR\");\n\n dataset.add(new Transaction(\"tx1\", dynamicUSD));\n dataset.add(new Transaction(\"tx2\", dynamicEUR));\n dataset.add(new Transaction(\"tx3\", dynamicUSD));\n\n List<Transaction> result = filter.filterByCurrency(dataset, \"USD\");\n\n assertEquals(2, result.size(), \"Should find 2 USD transactions even if memory addresses differ\");\n }\n}",
53
  "comment":"== checks for the same reference in memory, not value equality. MUST use .equals() to compare the string values of the currencies."
@@ -57,8 +57,8 @@
57
  "prompt_nl":"Waarom leest deze methode de csv-gegevens niet correct? Repareer de methode.",
58
  "code_snippet_input":"/* CSV DATA CONTEXT:\npatient_id,full_name,birth_date,is_active,last_bill_amount,department\n101,Laura Smith,2002-05-20,true,150.00,Cardiology\n...\n110,Sam I Am,1960-09-09,false,NA,Psychiatry\n*/\n\npublic static double getBillAmount(String csvLine) {\n String[] columns = csvLine.split(\",\");\n String rawAmount = columns[4];\n return Double.parseDouble(rawAmount);\n}",
59
  "canonical_solution":"public static double getBillAmount(String csvLine) {\n String[] columns = csvLine.split(\",\");\n if (columns.length <= 4) return Double.NaN;\n\n String rawAmount = columns[4].trim();\n\n if (rawAmount.equalsIgnoreCase(\"NA\") || rawAmount.isEmpty()) {\n return Double.NaN;\n }\n\n try {\n return Double.parseDouble(rawAmount);\n } catch (NumberFormatException e) {\n return Double.NaN;\n }\n}",
60
- "unit_test_setup":"",
61
- "unit_test_assertion":"@Test\n public void testValidAmount() {\n String line = \"101,Laura Smith,2002-05-20,true,150.00,Cardiology\";\n assertEquals(150.00, getBillAmount(line), 0.001);\n }\n\n @Test\n public void testNAValue() {\n String line = \"110,Sam I Am,1960-09-09,false,NA,Psychiatry\";\n assertTrue(Double.isNaN(getBillAmount(line)), \"NA should return NaN, not throw exception\");\n }\n\n @Test\n public void testGarbageValue() {\n String line = \"105,Big Mike,1978-06-30,0,FREE,Emergency\";\n assertTrue(Double.isNaN(getBillAmount(line)), \"Invalid text should return NaN\");\n }\n}",
62
  "comment":"the method fails to handle 'NA' values and possible formatting issues. MUST check for 'NA' and handle NumberFormatException to avoid crashes."
63
  }
64
  {"id":"base_java_08","dataset_type":"base","language":"Java","task_category":"id_bug",
@@ -66,17 +66,17 @@
66
  "prompt_nl":"Ik wil deze methode gebruiken om een vierkante matrix te transponeren, maar het geeft verkeerde resultaten. Corrigeer de methode.",
67
  "code_snippet_input":"public static int[][] transposeMatrix(int[][] input) {\n int rows = input.length;\n int cols = input[0].length;\n int[][] output = new int[cols][rows];\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n output[i][j] = input[i][j];\n }\n }\n return output;\n}",
68
  "canonical_solution":"public static int[][] transposeMatrix(int[][] input) {\n int rows = input.length;\n int cols = input[0].length;\n int[][] output = new int[cols][rows];\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n output[j][i] = input[i][j];\n }\n }\n return output;\n}",
69
- "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\n\npublic class Solution {",
70
- "unit_test_assertion":" @Test\n public void testTranspose2x2() {\n int[][] input = { {1, 2}, {3, 4} };\n int[][] expected = { {1, 3}, {2, 4} };\n assertArrayEquals(expected, transposeMatrix(input), \"Should swap rows and columns correctly\");\n }\n\n @Test\n public void testTranspose3x3() {\n int[][] input = {\n {1, 2, 3},\n {4, 5, 6},\n {7, 8, 9}\n };\n int[][] expected = {\n {1, 4, 7},\n {2, 5, 8},\n {3, 6, 9}\n };\n assertArrayEquals(expected, transposeMatrix(input));\n }\n}",
71
  "comment":"the method incorrectly assigns values to the output matrix into wrong positions, MUST assign output[j][i] = input[i][j] to transpose correctly."
72
  }
73
  {"id":"base_java_09","dataset_type":"base","language":"Java","task_category":"architecture",
74
- "prompt_en":"create a singleton DatabaseConnection class in java with a getInstance method.",
75
- "prompt_nl":"Maak een singleton DatabaseConnection klasse in java met een getInstance methode.",
76
  "code_snippet_input":"",
77
- "canonical_solution": "public class DatabaseConnection {\n private static volatile DatabaseConnection instance;\n private DatabaseConnection() {}\n public static DatabaseConnection getInstance() {\n if (instance == null) {\n synchronized (DatabaseConnection.class) {\n if (instance == null) {\n instance = new DatabaseConnection();\n }\n }\n }\n return instance;\n }\n}",
78
  "unit_test_setup": "import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\nimport java.lang.reflect.*;",
79
- "unit_test_assertion": "\nclass SingletonTest {\n @Test\n public void testSingletonUniqueInstance() throws InterruptedException {\n DatabaseConnection[] instances = new DatabaseConnection[2];\n Thread t1 = new Thread(() -> instances[0] = DatabaseConnection.getInstance());\n Thread t2 = new Thread(() -> instances[1] = DatabaseConnection.getInstance());\n t1.start();\n t2.start();\n t1.join();\n t2.join();\n assertNotNull(instances[0]);\n assertSame(instances[0], instances[1], \"Both threads must receive the exact same instance\");\n }\n\n @Test\n public void testConstructorIsPrivate() throws Exception {\n Constructor<DatabaseConnection> constructor = DatabaseConnection.class.getDeclaredConstructor();\n assertTrue(Modifier.isPrivate(constructor.getModifiers()), \"Constructor must be private\");\n }\n}",
80
  "comment":"the singleton pattern requires that only one instance of the class can exist at once. The solution MUST have a private constructor and a method getInstance() that creates a single database connection."
81
  }
82
  {"id":"base_java_10","dataset_type":"base","language":"Java","task_category":"refactoring",
@@ -84,8 +84,8 @@
84
  "prompt_nl":"transformeer deze functie zodat deze datetime objecten gebruikt waarbij de deadline aan het begin van de dag ligt, terwijl deze nog steeds compatibel is met de inputs van de software.",
85
  "code_snippet_input":"public static boolean isOverdue(LocalDate deadline) {\n LocalDate today = LocalDate.now();\n return today.isAfter(deadline);\n}",
86
  "canonical_solution":"public static boolean isOverdue(LocalDate deadlineDate) {\n LocalDateTime currentDateTime = LocalDateTime.now();\n LocalDateTime deadlineTimestamp = deadlineDate.atStartOfDay();\n return currentDateTime.isAfter(deadlineTimestamp);\n}",
87
- "unit_test_setup":"import java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\n\npublic class DateTest {\n\n",
88
- "unit_test_assertion":"@Test\n public void testYesterdayIsOverdue() {\n assertTrue(isOverdue(LocalDate.now().minusDays(1)), \"Yesterday should be overdue\");\n }\n\n @Test\n public void testTomorrowIsNotOverdue() {\n assertFalse(isOverdue(LocalDate.now().plusDays(1)), \"Tomorrow should not be overdue\");\n }\n\n @Test\n public void testTodayIsOverdue() {\n assertTrue(isOverdue(LocalDate.now()), \"Today (current time) should be considered after Today (start of day)\");\n }\n}",
89
  "comment":"the original method ignores time of day so assignments due on the same day are not overdue, the solution MUST set the deadline to the start of the day and compare with current date and time, so that assignemnts due on the same day are overdue. The unit test includes structural checks (as well as functional checks) to ensure refactoring."
90
  }
91
  {"id":"base_java_11","dataset_type":"base","language":"Java","task_category":"refactoring",
@@ -93,18 +93,18 @@
93
  "prompt_nl":"deze methode groepeert transacties van meer dan 1000 per valuta. Refactor deze om streams te gebruiken.",
94
  "code_snippet_input":"public Map<String, List<Transaction>> groupHighValueTransactions(List<Transaction> transactions) {\n Map<String, List<Transaction>> result = new HashMap<>();\n for (Transaction t : transactions) {\n if (t.getAmount() > 1000) {\n String currency = t.getCurrency();\n if (!result.containsKey(currency)) {\n result.put(currency, new ArrayList<>());\n }\n result.get(currency).add(t);\n }\n }\n return result;\n}",
95
  "canonical_solution":"public Map<String, List<Transaction>> groupHighValueTransactions(List<Transaction> transactions) {\nreturn transactions.stream()\n.filter(t -> t.getAmount() > 1000)\n.collect(Collectors.groupingBy(Transaction::getCurrency));\n}",
96
- "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.nio.file.*;\nimport java.io.IOException;\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass Transaction {\n private String currency;\n private double amount;\n public Transaction(String currency, double amount) { \n this.currency = currency; \n this.amount = amount; \n }\n public String getCurrency() { return currency; }\n public double getAmount() { return amount; }\n}\n\npublic class Solution {",
97
- "unit_test_assertion":" @Test\n public void testGrouping() {\n List<Transaction> data = Arrays.asList(\n new Transaction(\"USD\", 500),\n new Transaction(\"USD\", 1500),\n new Transaction(\"EUR\", 2000),\n new Transaction(\"USD\", 3000)\n );\n \n Map<String, List<Transaction>> result = groupHighValueTransactions(data);\n \n assertEquals(2, result.size());\n assertEquals(2, result.get(\"USD\").size());\n }\n\n @Test\n public void testRefactoringCompliance() throws IOException {\n \n String source = Files.readString(Path.of(\"Solution.java\"));\n \n assertTrue(source.contains(\".stream(\"), \"LLM failed to use Stream API\");\n assertTrue(source.contains(\".collect(\"), \"LLM failed to use Collector\");\n assertFalse(source.contains(\"for (\"), \"LLM failed to remove 'for' loop\");\n }\n}",
98
- "comment":"RUNNER MUST SAVE SOLUTION IN Solution.java Includes a structural check to ensure the LLM actually followed the instruction to use Streams. The unit test includes structural checks (as well as functional checks) to ensure refactoring."
99
  }
100
  {"id":"base_java_12","dataset_type":"base","language":"Java","task_category":"refactoring",
101
  "prompt_en":"This is a method that returns a discount code based on the day of the week, refactor the method to use a modern switch expression. Keep the same functionality",
102
  "prompt_nl":"Dit is een methode die een kortingscode retourneert op basis van de dag van de week. Herstructureer de methode om een moderne switch-expressie te gebruiken. Behoud dezelfde functionaliteit.",
103
  "code_snippet_input":"public String getDiscountCode(String dayOfWeek) {\n String discount;\n switch (dayOfWeek) {\n case \"Monday\":\n discount = \"MANIC_MONDAY_15\";\n break;\n case \"Wednesday\":\n discount = \"WACKY_WED_10\";\n break;\n case \"Friday\":\n discount = \"TGIF_25\";\n break;\n case \"Saturday\":\n case \"Sunday\":\n discount = \"WEEKEND_SAVER_20\";\n break;\n default:\n discount = \"STANDARD_PRICING\";\n break;\n }\n return discount;\n}",
104
  "canonical_solution":"public String getDiscountCode(String dayOfWeek) {\n return switch (dayOfWeek) {\n case \"Monday\" -> \"MANIC_MONDAY_15\";\n case \"Wednesday\" -> \"WACKY_WED_10\";\n case \"Friday\" -> \"TGIF_25\";\n case \"Saturday\", \"Sunday\" -> \"WEEKEND_SAVER_20\";\n default -> \"STANDARD_PRICING\";\n };\n}",
105
- "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.nio.file.*;\nimport java.io.IOException;\nimport static org.junit.jupiter.api.Assertions.*;\n\npublic class Solution {",
106
- "unit_test_assertion":" @Test\n public void testDiscounts() {\n assertEquals(\"MANIC_MONDAY_15\", getDiscountCode(\"Monday\"));\n assertEquals(\"WEEKEND_SAVER_20\", getDiscountCode(\"Sunday\"));\n assertEquals(\"STANDARD_PRICING\", getDiscountCode(\"Tuesday\"));\n }\n\n @Test\n public void testModernSyntax() throws IOException {\n String source = Files.readString(Path.of(\"Solution.java\"));\n \n assertTrue(source.contains(\"->\"), \"LLM failed to use modern arrow syntax '->'\");\n assertFalse(source.contains(\"break;\"), \"LLM failed to remove legacy 'break' statements\");\n }\n}",
107
- "comment":"RUNNER MUST SAVE SOLUTION IN Solution.java the old method uses the old switch statement with multiple breaks and variable assignments, the solution MUST use the modern switch expression syntax introduced in Java 14 while keeping the same functionality. The unit test includes structural checks (as well as functional checks) to ensure refactoring."
108
  }
109
  {"id":"base_javascript_01","dataset_type":"base","language":"JavaScript","task_category":"scaffolding",
110
  "prompt_en":"write a JavaScript function called createReactScaffold(projectName) that creates a basic project structure for a React app using Vite. Return ONLY the function.",
 
3
  "prompt_nl":"Schrijf een statische methode createScaffold(String rootDir) in Java die een basisprojectstructuur voor Maven creëert. Retourneer ALLEEN de methode.",
4
  "code_snippet_input":"",
5
  "canonical_solution":"public static void createScaffold(String rootDir) throws IOException {\n Path root = Paths.get(rootDir);\n Files.createDirectories(root.resolve(\"src/main/java\"));\n Files.createDirectories(root.resolve(\"src/test/java\"));\n}",
6
+ "unit_test_setup": "import org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.io.TempDir;\nimport java.io.IOException;\nimport java.nio.file.*;\nimport static org.junit.jupiter.api.Assertions.*;\n",
7
+ "unit_test_assertion":"\n @Test\n public void testDirectoryCreation(@TempDir Path tempDir) throws IOException {\n createScaffold(tempDir.toString());\n assertTrue(Files.exists(tempDir.resolve(\"src/main/java\")), \"src/main/java should exist\");\n assertTrue(Files.exists(tempDir.resolve(\"src/test/java\")), \"src/test/java should exist\");\n assertTrue(Files.isDirectory(tempDir.resolve(\"src/main/java\")), \"Should be a directory\");\n }",
8
  "comment":"the folder structure should contain AT LEAST src/main/java/ and src/test/java/ directories since they're required for every maven project"
9
  }
10
  {"id":"base_java_02","dataset_type":"base","language":"Java","task_category":"elem_func",
 
19
  {"id":"base_java_03","dataset_type":"base","language":"Java","task_category":"fix_bug",
20
  "prompt_en":"why am I getting a compilation error in this code? fix it.",
21
  "prompt_nl":"waarom krijg ik een compilatie error in deze code? Los het op.",
22
+ "code_snippet_input":"/*Local variable counter defined in an enclosing scope must be final or effectively final*/ \npublic static List<String> generateResults() {\nList<String> results = new ArrayList<>();\nint counter = 0;\nList<String> names = List.of(\"Alice\", \"Bob\", \"Charlie\");\n\nnames.forEach(name -> {\n counter++;\n results.add(counter + \": \" + name);\n});\nreturn results;\n}",
23
+ "canonical_solution":"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\n\npublic static List<String> generateResults() {\nList<String> results = new ArrayList<>();\nAtomicInteger counter = new AtomicInteger(0);\nList<String> names = List.of(\"Alice\", \"Bob\", \"Charlie\");\n\nnames.forEach(name -> {\n results.add(counter.incrementAndGet() + \": \" + name);\n});\nreturn results;\n}",
24
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport static org.junit.jupiter.api.Assertions.*;\n\n",
25
+ "unit_test_assertion":"\n\n @Test\n public void testCounterIncrements() {\n List<String> results = generateResults();\n\n assertEquals(3, results.size(), \"List should contain 3 elements\");\n assertTrue(results.get(0).startsWith(\"1:\"), \"First element must start with 1:\");\n assertTrue(results.get(1).startsWith(\"2:\"), \"Second element must start with 2:\");\n assertTrue(results.get(2).startsWith(\"3:\"), \"Third element must start with 3:\");\n}",
26
  "comment":"counter variable is not final, and cant be changed within the lambda. MUST use an AtomicInteger instead to hold the counter, which allows us to modify its value within the lambda."
27
  }
28
  {"id":"base_java_04","dataset_type":"base","language":"Java","task_category":"fix_bug",
29
  "prompt_en":"why am I getting a compilation error in this code? fix it",
30
  "prompt_nl":"waarom krijg ik een compilatie error in deze code? Los het op.",
31
  "code_snippet_input":"/*name clash: method(List<String>) has the same erasure as method(List<Integer>)*/\npublic String sort(List<String> data) {\n return \"Sorting strings\";\n}\n\npublic String sort(List<Integer> data) {\n return \"Sorting integers\";\n}",
32
+ "canonical_solution":"public String sortStrings(List<String> data) {\n return \"Sorting strings\";\n }\n\n public String sortIntegers(List<Integer> data) {\n return \"Sorting integers\";\n }",
33
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport static org.junit.jupiter.api.Assertions.*;\n",
34
+ "unit_test_assertion":"\n @Test\n public void testMethodsAreDistinct() {\n Solution sol = new Solution();\n String result1 = sol.sortStrings(new ArrayList<String>());\n String result2 = sol.sortIntegers(new ArrayList<Integer>());\n\n assertEquals(\"Sorting strings\", result1);\n assertEquals(\"Sorting integers\", result2);\n }",
35
+ "comment":"Java type erasure means List<String> and List<Integer> both become List at runtime, preventing overloading. The solution must rename the methods. Note: Added instantiation of Solution in test assertion to ensure it runs regardless of static/instance context."
36
  }
37
  {"id":"base_java_05","dataset_type":"base","language":"Java","task_category":"fix_bug",
38
  "prompt_en":"why am I getting a compilation error in this code? I want to use the process from printer. Output only the fixed class.",
39
  "prompt_nl":"Waarom krijg ik een compilatiefout in deze code? Ik wil het proces van printer gebruiken. Geef alleen de vaste klasse weer.",
40
+ "code_snippet_input":"/*class OfficeMachine inherits unrelated defaults for process() from types Printer and Scanner*/\nclass OfficeMachine implements Printer, Scanner {\n}",
41
+ "canonical_solution":"class OfficeMachine implements Printer, Scanner {\n @Override\n public String process() {\n return Printer.super.process();\n }\n}",
42
  "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\ninterface Printer {\n default String process() { return \"Printing document...\"; }\n}\n\ninterface Scanner {\n default String process() { return \"Scanning document...\"; }\n}\n",
43
+ "unit_test_assertion":"@Test\npublic void testConflictResolution() {\n OfficeMachine machine = new OfficeMachine();\n assertEquals(\"Printing document...\", machine.process(), \"Should return Printer's output\");\n}",
44
  "comment":"the error happens because officemachine implements two methods with the same name from different interfaces. the soluction MUST override the process() method to explicitly call the Printer's default method."
45
  }
46
  {"id":"base_java_06","dataset_type":"base","language":"Java","task_category":"id_bug",
47
  "prompt_en":"why am i getting wrong results in this code? The method doesn't return a list of the transaction in the target currency. Fix the method.",
48
  "prompt_nl":"Waarom krijg ik verkeerde resultaten in deze code? De methode retourneert geen lijst met transacties in de doelvaluta. Corrigeer de methode.",
49
+ "code_snippet_input":"class DataFilter {\n public List<Transaction> filterByCurrency(List<Transaction> data, String targetCurrency) {\n List<Transaction> result = new ArrayList<>();\n for (Transaction t : data) {\n if (t.getCurrency() == targetCurrency) {\n result.add(t);\n }\n }\n return result;\n }\n}",
50
+ "canonical_solution":"class DataFilter {\n public List<Transaction> filterByCurrency(List<Transaction> data, String targetCurrency) {\n List<Transaction> result = new ArrayList<>();\n for (Transaction t : data) {\n if (targetCurrency.equals(t.getCurrency())) {\n result.add(t);\n }\n }\n return result;\n }\n}",
51
  "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.List;\nimport java.util.ArrayList;\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass Transaction {\n private String id;\n private String currency;\n public Transaction(String id, String currency) { this.id = id; this.currency = currency; }\n public String getCurrency() { return currency; }\n}",
52
  "unit_test_assertion":"class DataFilterTest {\n @Test\n public void testCurrencyFiltering() {\n DataFilter filter = new DataFilter();\n List<Transaction> dataset = new ArrayList<>();\n\n String dynamicUSD = new String(\"USD\");\n String dynamicEUR = new String(\"EUR\");\n\n dataset.add(new Transaction(\"tx1\", dynamicUSD));\n dataset.add(new Transaction(\"tx2\", dynamicEUR));\n dataset.add(new Transaction(\"tx3\", dynamicUSD));\n\n List<Transaction> result = filter.filterByCurrency(dataset, \"USD\");\n\n assertEquals(2, result.size(), \"Should find 2 USD transactions even if memory addresses differ\");\n }\n}",
53
  "comment":"== checks for the same reference in memory, not value equality. MUST use .equals() to compare the string values of the currencies."
 
57
  "prompt_nl":"Waarom leest deze methode de csv-gegevens niet correct? Repareer de methode.",
58
  "code_snippet_input":"/* CSV DATA CONTEXT:\npatient_id,full_name,birth_date,is_active,last_bill_amount,department\n101,Laura Smith,2002-05-20,true,150.00,Cardiology\n...\n110,Sam I Am,1960-09-09,false,NA,Psychiatry\n*/\n\npublic static double getBillAmount(String csvLine) {\n String[] columns = csvLine.split(\",\");\n String rawAmount = columns[4];\n return Double.parseDouble(rawAmount);\n}",
59
  "canonical_solution":"public static double getBillAmount(String csvLine) {\n String[] columns = csvLine.split(\",\");\n if (columns.length <= 4) return Double.NaN;\n\n String rawAmount = columns[4].trim();\n\n if (rawAmount.equalsIgnoreCase(\"NA\") || rawAmount.isEmpty()) {\n return Double.NaN;\n }\n\n try {\n return Double.parseDouble(rawAmount);\n } catch (NumberFormatException e) {\n return Double.NaN;\n }\n}",
60
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;",
61
+ "unit_test_assertion":"@Test\n public void testValidAmount() {\n String line = \"101,Laura Smith,2002-05-20,true,150.00,Cardiology\";\n assertEquals(150.00, getBillAmount(line), 0.001);\n }\n\n @Test\n public void testNAValue() {\n String line = \"110,Sam I Am,1960-09-09,false,NA,Psychiatry\";\n assertTrue(Double.isNaN(getBillAmount(line)), \"NA should return NaN, not throw exception\");\n }\n\n @Test\n public void testGarbageValue() {\n String line = \"105,Big Mike,1978-06-30,0,FREE,Emergency\";\n assertTrue(Double.isNaN(getBillAmount(line)), \"Invalid text should return NaN\");\n }",
62
  "comment":"the method fails to handle 'NA' values and possible formatting issues. MUST check for 'NA' and handle NumberFormatException to avoid crashes."
63
  }
64
  {"id":"base_java_08","dataset_type":"base","language":"Java","task_category":"id_bug",
 
66
  "prompt_nl":"Ik wil deze methode gebruiken om een vierkante matrix te transponeren, maar het geeft verkeerde resultaten. Corrigeer de methode.",
67
  "code_snippet_input":"public static int[][] transposeMatrix(int[][] input) {\n int rows = input.length;\n int cols = input[0].length;\n int[][] output = new int[cols][rows];\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n output[i][j] = input[i][j];\n }\n }\n return output;\n}",
68
  "canonical_solution":"public static int[][] transposeMatrix(int[][] input) {\n int rows = input.length;\n int cols = input[0].length;\n int[][] output = new int[cols][rows];\n for (int i = 0; i < rows; i++) {\n for (int j = 0; j < cols; j++) {\n output[j][i] = input[i][j];\n }\n }\n return output;\n}",
69
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\n",
70
+ "unit_test_assertion":"@Test\n public void testTranspose2x2() {\n int[][] input = { {1, 2}, {3, 4} };\n int[][] expected = { {1, 3}, {2, 4} };\n assertArrayEquals(expected, transposeMatrix(input), \"Should swap rows and columns correctly\");\n }\n\n @Test\n public void testTranspose3x3() {\n int[][] input = {\n {1, 2, 3},\n {4, 5, 6},\n {7, 8, 9}\n };\n int[][] expected = {\n {1, 4, 7},\n {2, 5, 8},\n {3, 6, 9}\n };\n assertArrayEquals(expected, transposeMatrix(input));\n }",
71
  "comment":"the method incorrectly assigns values to the output matrix into wrong positions, MUST assign output[j][i] = input[i][j] to transpose correctly."
72
  }
73
  {"id":"base_java_09","dataset_type":"base","language":"Java","task_category":"architecture",
74
+ "prompt_en":"create a static singleton DatabaseConnection class in java with a getInstance method.",
75
+ "prompt_nl":"Maak een statische singleton DatabaseConnection klasse in java met een getInstance methode.",
76
  "code_snippet_input":"",
77
+ "canonical_solution": "public static class DatabaseConnection {\n private static volatile DatabaseConnection instance;\n private DatabaseConnection() {}\n public static DatabaseConnection getInstance() {\n if (instance == null) {\n synchronized (DatabaseConnection.class) {\n if (instance == null) {\n instance = new DatabaseConnection();\n }\n }\n }\n return instance;\n }\n}",
78
  "unit_test_setup": "import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\nimport java.lang.reflect.*;",
79
+ "unit_test_assertion": "@Test\n public void testSingletonUniqueInstance() throws InterruptedException {\n DatabaseConnection[] instances = new DatabaseConnection[2];\n Thread t1 = new Thread(() -> instances[0] = DatabaseConnection.getInstance());\n Thread t2 = new Thread(() -> instances[1] = DatabaseConnection.getInstance());\n t1.start();\n t2.start();\n t1.join();\n t2.join();\n assertNotNull(instances[0]);\n assertSame(instances[0], instances[1], \"Both threads must receive the exact same instance\");\n }\n\n @Test\n public void testConstructorIsPrivate() throws Exception {\n Constructor<DatabaseConnection> constructor = DatabaseConnection.class.getDeclaredConstructor();\n assertTrue(Modifier.isPrivate(constructor.getModifiers()), \"Constructor must be private\");\n }",
80
  "comment":"the singleton pattern requires that only one instance of the class can exist at once. The solution MUST have a private constructor and a method getInstance() that creates a single database connection."
81
  }
82
  {"id":"base_java_10","dataset_type":"base","language":"Java","task_category":"refactoring",
 
84
  "prompt_nl":"transformeer deze functie zodat deze datetime objecten gebruikt waarbij de deadline aan het begin van de dag ligt, terwijl deze nog steeds compatibel is met de inputs van de software.",
85
  "code_snippet_input":"public static boolean isOverdue(LocalDate deadline) {\n LocalDate today = LocalDate.now();\n return today.isAfter(deadline);\n}",
86
  "canonical_solution":"public static boolean isOverdue(LocalDate deadlineDate) {\n LocalDateTime currentDateTime = LocalDateTime.now();\n LocalDateTime deadlineTimestamp = deadlineDate.atStartOfDay();\n return currentDateTime.isAfter(deadlineTimestamp);\n}",
87
+ "unit_test_setup":"import java.time.LocalDate;\nimport java.time.LocalDateTime;\nimport org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\n\n",
88
+ "unit_test_assertion":"@Test\n public void testYesterdayIsOverdue() {\n assertTrue(isOverdue(LocalDate.now().minusDays(1)), \"Yesterday should be overdue\");\n }\n\n @Test\n public void testTomorrowIsNotOverdue() {\n assertFalse(isOverdue(LocalDate.now().plusDays(1)), \"Tomorrow should not be overdue\");\n }\n\n @Test\n public void testTodayIsOverdue() {\n assertTrue(isOverdue(LocalDate.now()), \"Today (current time) should be considered after Today (start of day)\");\n }",
89
  "comment":"the original method ignores time of day so assignments due on the same day are not overdue, the solution MUST set the deadline to the start of the day and compare with current date and time, so that assignemnts due on the same day are overdue. The unit test includes structural checks (as well as functional checks) to ensure refactoring."
90
  }
91
  {"id":"base_java_11","dataset_type":"base","language":"Java","task_category":"refactoring",
 
93
  "prompt_nl":"deze methode groepeert transacties van meer dan 1000 per valuta. Refactor deze om streams te gebruiken.",
94
  "code_snippet_input":"public Map<String, List<Transaction>> groupHighValueTransactions(List<Transaction> transactions) {\n Map<String, List<Transaction>> result = new HashMap<>();\n for (Transaction t : transactions) {\n if (t.getAmount() > 1000) {\n String currency = t.getCurrency();\n if (!result.containsKey(currency)) {\n result.put(currency, new ArrayList<>());\n }\n result.get(currency).add(t);\n }\n }\n return result;\n}",
95
  "canonical_solution":"public Map<String, List<Transaction>> groupHighValueTransactions(List<Transaction> transactions) {\nreturn transactions.stream()\n.filter(t -> t.getAmount() > 1000)\n.collect(Collectors.groupingBy(Transaction::getCurrency));\n}",
96
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.nio.file.*;\nimport java.io.IOException;\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass Transaction {\n private String currency;\n private double amount;\n public Transaction(String currency, double amount) { \n this.currency = currency; \n this.amount = amount; \n }\n public String getCurrency() { return currency; }\n public double getAmount() { return amount; }\n}\n",
97
+ "unit_test_assertion":" @Test\n public void testGrouping() {\n List<Transaction> data = Arrays.asList(\n new Transaction(\"USD\", 500),\n new Transaction(\"USD\", 1500),\n new Transaction(\"EUR\", 2000),\n new Transaction(\"USD\", 3000)\n );\n \n Map<String, List<Transaction>> result = groupHighValueTransactions(data);\n \n assertEquals(2, result.size());\n assertEquals(2, result.get(\"USD\").size());\n }\n\n @Test\n public void testRefactoringCompliance() throws IOException {\n String source = Files.readString(Path.of(\"Solution.java\"));\n String solutionPart = source.split(\"testGrouping\")[0];\n assertTrue(solutionPart.contains(\".stream(\"), \"LLM failed to use Stream API\");\n assertTrue(solutionPart.contains(\".collect(\"), \"LLM failed to use Collector\");\n assertFalse(solutionPart.contains(\"for (\"), \"LLM failed to remove 'for' loop\");\n }",
98
+ "comment":"the unit test includes structural checks (as well as functional checks) to ensure refactoring, the solution MUST use streams and collectors to filter and group the transactions, and remove the explicit for loop and if statements."
99
  }
100
  {"id":"base_java_12","dataset_type":"base","language":"Java","task_category":"refactoring",
101
  "prompt_en":"This is a method that returns a discount code based on the day of the week, refactor the method to use a modern switch expression. Keep the same functionality",
102
  "prompt_nl":"Dit is een methode die een kortingscode retourneert op basis van de dag van de week. Herstructureer de methode om een moderne switch-expressie te gebruiken. Behoud dezelfde functionaliteit.",
103
  "code_snippet_input":"public String getDiscountCode(String dayOfWeek) {\n String discount;\n switch (dayOfWeek) {\n case \"Monday\":\n discount = \"MANIC_MONDAY_15\";\n break;\n case \"Wednesday\":\n discount = \"WACKY_WED_10\";\n break;\n case \"Friday\":\n discount = \"TGIF_25\";\n break;\n case \"Saturday\":\n case \"Sunday\":\n discount = \"WEEKEND_SAVER_20\";\n break;\n default:\n discount = \"STANDARD_PRICING\";\n break;\n }\n return discount;\n}",
104
  "canonical_solution":"public String getDiscountCode(String dayOfWeek) {\n return switch (dayOfWeek) {\n case \"Monday\" -> \"MANIC_MONDAY_15\";\n case \"Wednesday\" -> \"WACKY_WED_10\";\n case \"Friday\" -> \"TGIF_25\";\n case \"Saturday\", \"Sunday\" -> \"WEEKEND_SAVER_20\";\n default -> \"STANDARD_PRICING\";\n };\n}",
105
+ "unit_test_setup":"import org.junit.jupiter.api.Test;\nimport java.nio.file.*;\nimport java.io.IOException;\nimport static org.junit.jupiter.api.Assertions.*;\n",
106
+ "unit_test_assertion":" @Test\n public void testDiscounts() {\n assertEquals(\"MANIC_MONDAY_15\", getDiscountCode(\"Monday\"));\n assertEquals(\"WEEKEND_SAVER_20\", getDiscountCode(\"Sunday\"));\n assertEquals(\"STANDARD_PRICING\", getDiscountCode(\"Tuesday\"));\n }\n\n @Test\n public void testModernSyntax() throws IOException {\n String source = Files.readString(Path.of(\"Solution.java\"));\n String solutionPart = source.split(\"testGrouping\")[0];\n assertTrue(solutionPart.contains(\"->\"), \"LLM failed to use modern arrow syntax '->'\");\n assertFalse(solutionPart.contains(\"break;\"), \"LLM failed to remove legacy 'break' statements\");\n }",
107
+ "comment":"the old method uses the old switch statement with multiple breaks and variable assignments, the solution MUST use the modern switch expression syntax introduced in Java 14 while keeping the same functionality. The unit test includes structural checks (as well as functional checks) to ensure refactoring."
108
  }
109
  {"id":"base_javascript_01","dataset_type":"base","language":"JavaScript","task_category":"scaffolding",
110
  "prompt_en":"write a JavaScript function called createReactScaffold(projectName) that creates a basic project structure for a React app using Vite. Return ONLY the function.",