{"id":"stress_groovy_01","dataset_type":"stress","language":"Groovy","task_category":"elem_func", "prompt_en":"write a singleton DatabaseConnection class in Groovy with the builder pattern. It must have fields for url, timeout and encrypted, and have equals, hashCode and toString methods.", "prompt_nl":"Schrijf een singleton DatabaseConnection klasse in Groovy met het builder patroon. Deze moet velden hebben voor url, timeout en encrypted, en beschikken over equals, hashCode en toString methoden.", "code_snippet_input":"", "canonical_solution":"import groovy.transform.Canonical\nimport groovy.transform.builder.Builder\n\n@Singleton(lazy = true)\n@Canonical\n@Builder\nclass DatabaseConnection {\n String url\n Integer timeout\n Boolean encrypted\n}", "unit_test_setup":"import groovy.lang.GroovyClassLoader\n\ndef evalCode(String llmOutput) {\n GroovyClassLoader loader = new GroovyClassLoader()\n try {\n Class clazz = loader.parseClass(llmOutput)\n return clazz\n } catch (Exception e) {\n return \"Compilation Error: ${e.message}\"\n }\n}", "unit_test_assertion":"def testSolution(Object result) {\n if (result instanceof String && result.contains(\"Error\")) return result\n Class clazz = (Class) result\n\n def hasSingleton = clazz.methods.any { it.name == 'getInstance' }\n def hasCanonical = clazz.methods.any { it.name == 'canEqual' }\n def hasBuilder = clazz.declaredClasses.any { it.simpleName.contains('Builder') }\n\n assert hasSingleton : \"failed to use @Singleton\"\n assert hasCanonical : \"failed to use @Canonical or @EqualsAndHashCode\"\n assert hasBuilder : \"failed to use @Builder\"\n\n return \"PASS\"\n}", "comment":"Groovy automatically handles the boilerplate code for a singleton and builder architecture by using the @Singleton and @Builder annotations. The @Canonical annotation is used to generate the equals, hashCode, and toString methods based on the fields of the class. The solution MUST use @Singleton, @Builder and @Canonical annotations, instead of writing the boilerplate code manually, and MUST have AT LEAST the fields url, timeout and encrypted." } {"id":"stress_groovy_02","dataset_type":"stress","language":"Groovy","task_category":"id_bug", "prompt_en":"I dont know why the second test case fails since they are different objects. fix the bug.", "prompt_nl":"Ik weet niet waarom de tweede testcase mislukt, aangezien het verschillende objecten zijn. Los de bug op.", "code_snippet_input":"@groovy.transform.EqualsAndHashCode\nclass Cell{\n private int x;\n private int y;\n Cell(x,y){\n this.x = x;\n this.y = y;\n } \n}\n\ndef liveCells = [] as Set\n\nCell cell = new Cell(0,0);\nCell diffCell = new Cell(1,1);\n\nliveCells.add(cell)\nassert liveCells.contains(cell) == true\nassert liveCells.contains(diffCell) == false", "canonical_solution":"@groovy.transform.EqualsAndHashCode\nclass Cell{\n int x;\n int y;\n \n}\n\ndef liveCells = [] as Set\n\nCell cell = new Cell(0,0);\nCell diffCell = new Cell(1,1);\n\nliveCells.add(cell)\nassert liveCells.contains(cell) == true\nassert liveCells.contains(diffCell) == false", "unit_test_setup":"import groovy.lang.GroovyClassLoader\n\ndef evalCode(String llmOutput) {\n def loader = new GroovyClassLoader()\n try {\n Class clazz = loader.parseClass(llmOutput)\n return clazz\n } catch (Exception e) {\n return \"Compilation Error: \" + e.message\n }\n}", "unit_test_assertion":"def testSolution(Object result) {\n if (result instanceof String) return result\n Class clazz = (Class) result\n def c1, c2\n try {\n c1 = clazz.newInstance(0, 0)\n c2 = clazz.newInstance(1, 1)\n } catch (e) {\n c1 = clazz.newInstance(x: 0, y: 0)\n c2 = clazz.newInstance(x: 1, y: 1)\n }\n\n assert c1.hashCode() != c2.hashCode() : \"bug still exists, HashCodes are identical\"\n assert !c1.equals(c2) : \"bug still exists, objects are considered equal\"\n def hasAnnotation = clazz.annotations.any { it.annotationType().name.contains(\"EqualsAndHashCode\") }\n def hasGeneratedMethods = clazz.methods.any { it.name == 'canEqual' }\n assert hasGeneratedMethods : \"did not use Groovy's EqualsAndHashCode transformation\"\n\n return \"PASS\"\n}", "comment":"In groovy @EqualsAndHashCode does not take into account private fields, so two objects with the same properties (none) but different private fields will have the same hashcode and be considered equal. The solution MUST remove the private fields OR use EqualsAndHashCode(includeFields=true) to include private fields in the equality check." } {"id":"stress_groovy_03","dataset_type":"stress","language":"Groovy","task_category":"syntax recall", "prompt_en":"write this logmessage so that the status dynamically updates in the log output at the time it is printed, without reassigning the logmessage variable.", "prompt_nl":"Schrijf dit logmessage zodat de status dynamisch wordt bijgewerkt in de loguitvoer.", "code_snippet_input":"class Logger {\n String status = 'initialized'\n def logMessage = \n}", "canonical_solution":"class Logger {\n String status = 'initialized'\n def logMessage = \"${-> status}\"\n}", "unit_test_setup":"import groovy.lang.GroovyClassLoader\ndef evalCode(String llmOutput) {\n def loader = new GroovyClassLoader()\n try {\n Class clazz = loader.parseClass(llmOutput)\n return [clazz: clazz, source: llmOutput]\n } catch (Exception e) {\n return \"Compilation Error: ${e.message}\"\n }\n}", "unit_test_assertion":"def testSolution(Object result) {\n if (result instanceof String && result.contains(\"Error\")) return result\n def clazz = result.clazz\n def source = result.source\n def instance = clazz.newInstance()\n instance.status = \"alpha\"\n def firstVal = instance.logMessage.toString()\n instance.status = \"omega\"\n def secondVal = instance.logMessage.toString()\n assert firstVal != secondVal : \"string did not update\"\n\n def usedLazySyntax = source =~ /[\\$]\\{ *->/\n assert usedLazySyntax : \"logic works, but didn't use the \\${-> } lazy syntax\"\n return \"PASS\"\n}", "comment":"In groovy, using Gstirng lazy evaluation syntax ${-> var} allows the string to print the current value of the variable at the time of evaluation, instead of at the time of the string's creation. The solution MUST use the ${-> var} syntax to ensure the log message updates dynamically with the current status." } {"id":"stress_vuejs_01","dataset_type":"stress","language":"VueJS","task_category":"UI_comps", "prompt_en":"Write a VueJS component for a header of a webpage that contains the name \"Christina's Bakery\", a dropdown manu with items \"Home\", \"Recipes\" and \"Contact\", and a search bar.", "prompt_nl":"Schrijf een VueJS-component voor een koptekst van een webpagina met de naam \"Christina's Bakery\", een vervolgkeuzemenu met de items \"Home\", \"Recepten\" en \"Contact\" en een zoekbalk.", "code_snippet_input":"", "canonical_solution":"\n\n\n", "unit_test_setup":"def evalCode(String llmOutput) {\n if (llmOutput == null || llmOutput.trim().isEmpty()) {\n return \"empty solution\"\n }\n return [source:llmOutput]\n}", "unit_test_assertion":"def testSolution(Object result) {\n if (result instanceof String && result.contains(\"Error\")) return result\n def source = result.source\n def requirements = [\n [/(?i)