Closed dinoboff closed 8 years ago
@SingaporeClouds Would it work like that?
ps: the verifier would return results similar to the current implementation except for the meta field which report the test runner run count and run time.
@SingaporeClouds
An easier solution (which only require to update the test and a template string in the current implementation) is to expect the following type of test and solution:
tests:
import java.util.*; //Arrays, Map, List
import org.junit.Test;
import static org.junit.Assert.*;
import junit.framework.*;
import com.singpath.SolutionRunner;
public class SingPathTest extends SolutionRunner {
@Test
public void testCapitalize() throws Exception {
SingPath one = new SingPath();
List<String> input = Arrays.asList("c2", "a5", "A3", "b1", "c1");;
List<String> expected = Arrays.asList("C2", "A5", "A3", "B1", "C1");
assertEquals(expected, one.capitalize(input));
}
}
solutions:
import java.util.*; //Arrays, Map, List
import java.util.stream.*; //Stream, IntStream, Collectors;
public class SingPath {
public List<String> capitalize(List<String> myList) {
List<String> result = myList.stream()
.map(s -> s.toUpperCase())
.collect(Collectors.toList());
return result;
}
}
It let both solution and tests import packages, no parsing involved. It also let the test case have multiple tests.
Ok. If this is what you recommend, let's try this.
By the way, if we always give the editor this test as an example along with this sample solution to experiment with, it will allow users to create new problems a lot more quickly.
On Thu, Jan 14, 2016 at 9:29 PM, Damien Lebrun notifications@github.com wrote:
@SingaporeClouds https://github.com/SingaporeClouds
An easier solution (which only require to update the test and a temple string in the current implementation is to expect the following type of test and solution:
tests:
import java.util.*; //Arrays, Map, List import org.junit.Test; import static org.junit.Assert.*; import junit.framework.*; import com.singpath.SolutionRunner; public class SingPathTest extends SolutionRunner { @Test public void testCapitalize() throws Exception { SingPath one = new SingPath(); List<String> input = Arrays.asList("c2", "a5", "A3", "b1", "c1");; List<String> expected = Arrays.asList("C2", "A5", "A3", "B1", "C1"); assertEquals(expected, one.capitalize(input)); } }
solutions:
import java.util.; //Arrays, Map, List import java.util.stream.; //Stream, IntStream, Collectors;
public class SingPath {
public List
capitalize(List myList) { List result = myList.stream() .map(s -> s.toUpperCase()) .collect(Collectors.toList()); return result; } } It let both solution and tests import packages, no parsing involved. It also let the test case have multiple tests.
— Reply to this email directly or view it on GitHub https://github.com/singpath/verifier/issues/25#issuecomment-171645020.
Best Regards, Chris Boesch Associate Professor of Information Systems (Education) Singapore Management University
@SingaporeClouds The verifier have been updated and the problems migrated.
What do you think?
The Java verifier looks good.
If it is difficult to do this, then the solution can be treated as the current user's solution to the problem. This is essentially what I'm doing already by having 2 tabs open in my browser - in one I'm editing the problem and in the other tab I'm solving the problem as a user. I'd rather just have a [Run Solution] button in the editor and then be able to see the test results below the buttons.
This will allow the problem editor to paste in some code to the hint which they believe will pass their tests. Once they have their tests working with a known good solution, they can remove all or as many lines of code as they want from the hint and save the problem.
So we just need:
[image: Inline image 1]
I've added this as issue #240.
On Sat, Jan 16, 2016 at 8:46 AM, Damien Lebrun notifications@github.com wrote:
@SingaporeClouds https://github.com/SingaporeClouds The verifier have been updated and the problems migrated.
What do you think?
— Reply to this email directly or view it on GitHub https://github.com/singpath/verifier/issues/25#issuecomment-172137750.
Best Regards, Chris Boesch Associate Professor of Information Systems (Education) Singapore Management University
Test would be defined as follow:
A solution would be define as:
The verifier would need to parse the solution find where to insert the user solution, compile the class, run it, encode the result and save it in firebase db.