19 lines
1.2 KiB
Python
19 lines
1.2 KiB
Python
from shpc_grader import SHPCProblem, SHPCTestCase
|
|
def hw1_correct_currying(answer, score):
|
|
return lambda submitted: (score if (submitted.strip() == answer) else 0)
|
|
|
|
hw1_2 = SHPCProblem("hw1-2", "hw1", "hw1",
|
|
[ "convert.c" ],
|
|
[
|
|
SHPCTestCase("./convert int 4155", hw1_correct_currying('00000000000000000001000000111011', 5)),
|
|
SHPCTestCase("./convert long -550" , hw1_correct_currying('1111111111111111111111111111111111111111111111111111110111011010', 5)),
|
|
SHPCTestCase("./convert float 3.1415" , hw1_correct_currying('01000000010010010000111001010110', 5)),
|
|
SHPCTestCase("./convert double 3.1415" , hw1_correct_currying('0100000000001001001000011100101011000000100000110001001001101111', 5)),
|
|
SHPCTestCase("./convert int -1" , hw1_correct_currying('11111111111111111111111111111111', 5)),
|
|
SHPCTestCase("./convert long -1" , hw1_correct_currying('1111111111111111111111111111111111111111111111111111111111111111', 5)),
|
|
SHPCTestCase("./convert float -1" , hw1_correct_currying('10111111100000000000000000000000', 5)),
|
|
SHPCTestCase("./convert double -1" , hw1_correct_currying('1011111111110000000000000000000000000000000000000000000000000000', 5)),
|
|
],
|
|
)
|
|
|