-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83ef6cf
commit 71ef942
Showing
17 changed files
with
334 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
using Tested; | ||
a | ||
public class Evaluator { zeffa ff v | ||
public static E vxwvsages = new List<Message>() { new Message("Expected DivideByZeroException, got something else.") }; | ||
return new EvaluationResult(false, "System.DivideByZeroException", actual == null ? "" : actual.ToString(), messages); | ||
} | ||
} | ||
}vv qega |
37 changes: 37 additions & 0 deletions
37
tests/exercises/division/evaluation/EvaluatorSyntaxError.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
module Evaluator where | ||
|
||
import EvaluationUtils | ||
import Control.Exception | ||
|
||
evaluate :: Maybe (SomeException) -> EvaluationResult | ||
evaluate Nothing = evaluationResult { | ||
readableExpected = Just $ show DivideByZero, | ||
readableActual = Just "", | ||
messages = [message "Expected DivideByZero, got nothing."] | ||
} | ||
evaluate (Just x) = | ||
case fromException x off aegaeglho hapyat²uùµajµjoµjµ µg jùµj ùtjùpµtjùpjµj(&µj µjµajtpµj | ||
|
||
egkzmknzk oih | ||
gcd | ||
|
||
|
||
|
||
|
||
|
||
zgg[message "Expected DivideByZero, got nothing."] | ||
} | ||
|
||
|
||
handleA :: ArithException -> EvaluationResult | ||
handleA DivideByZero = evaluationResult { | ||
result = True, | ||
readableExpected = Just $ show DivideByZero, | ||
readableActual = Just $ show DivideByZero | ||
} | ||
handleA other = evaluationResult { | ||
readableExpected = Just $ show DivideByZero, | ||
readableActual = Just $ show other, | ||
messages = [message "Expected DivideByZero, got something else."] | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/exercises/division/evaluation/EvaluatorSyntaxError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
public class Evaluator { egqdg sd | ||
public static EvaluationResult evaluate(Object actual) { | ||
if (actual instanceof ArithmeticException) { | ||
return EvaluationResuvd lt.builder(true) | ||
.withReadableExpected(actual.toString()) | ||
.withReadableActual(actual.toString()) | ||
.build(); | ||
} else { | ||
return EvaluationResusdlt.builder(false) | ||
.withReadableExpected("ArithmeticException") | ||
.withReadableActual(actual == null ? "" : actual.toString()) | ||
.withMessage(nbsd | ||
} | ||
|
||
} sbsdgssdé§u u |
16 changes: 16 additions & 0 deletions
16
tests/exercises/division/evaluation/EvaluatorSyntaxError.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Evaluator { ae | ||
companion object {t "t"&t | ||
@JvmStatic zfz"r'" '" ' | ||
fun evaluate(actual: Any?): EvaluationResult { | ||
return if (actual is ArithmeticException) { | ||
EvaluationResult.Builder(result = true, | ||
readableExpected = actual.toString(), | ||
aeg readableActual = actual.toString()).build() | ||
} else { | ||
EvalugtionResult.Builder(result = false, | ||
readableExpected = "ArithmeticException", | ||
readableActual = actual?.toString() ?: "") | ||
.withMessage(EvaluationResult.Message("Expected ArithmeticException, got something else.")) | ||
.build() | ||
qg | ||
}qd qsdvdvqd |
18 changes: 18 additions & 0 deletions
18
tests/exercises/division/evaluation/evaluator-syntax-error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
jdhbkd mbzough import traceback | ||
|
||
from evaluation_utils import EvaluationResult, Message | ||
|
||
|
||
def evaluate(value): | ||
if isinstance(value, ZeroDivisionError): | ||
# If a zero division error, show the stacktrace. | ||
formatted = "".join(traceback.format_exception(type(value), value, value.__traceback__)) | ||
return EvaluationResult(True, formatted, formatted) | ||
elif isinstance(value, Exception): | ||
# If another error, show the stacktrace as well. | ||
formatted = "".join(traceback.format_exception(type(value), value, value.__traceback__)) | ||
return EvaluationResult(False, "ZeroDivisionError", formatted, [Message(f"Verwachtte een ZeroDivisionError, maar kreeg een {type(value).__name__}.")]) | ||
else: | ||
# Else show the str of the value. | ||
actual = str(value) if value else "" | ||
return EvaluationResult(False, "ZeroDivisionError", actual, [Message("Verwachtte een ZeroDivisionError.")]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/exercises/division/evaluation/plan-runtime-exception.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"tabs": [ | ||
{ | ||
"name": "Feedback", | ||
"runs": [ | ||
{ | ||
"run": { | ||
"description": "Uitvoeren code", | ||
"input": { | ||
"main_call": true | ||
}, | ||
"output": { | ||
"exception": { | ||
"evaluator": { | ||
"type": "specific", | ||
"evaluators": { | ||
"python": { | ||
"file": "evaluator.py", | ||
"name": "runtime" | ||
}, | ||
"java": { | ||
"file": "Evaluator.java", | ||
"name": "runtime" | ||
}, | ||
"kotlin": { | ||
"file": "Evaluator.kt", | ||
"name": "runtime" | ||
}, | ||
"haskell": { | ||
"file": "Evaluator.hs", | ||
"name": "runtime" | ||
}, | ||
"runhaskell": { | ||
"file": "Evaluator.hs", | ||
"name": "runtime" | ||
}, | ||
"csharp": { | ||
"file": "Evaluator.cs", | ||
"name": "runtime" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
tests/exercises/division/evaluation/plan-syntax-error.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"tabs": [ | ||
{ | ||
"name": "Feedback", | ||
"runs": [ | ||
{ | ||
"run": { | ||
"description": "Uitvoeren code", | ||
"input": { | ||
"main_call": true | ||
}, | ||
"output": { | ||
"exception": { | ||
"evaluator": { | ||
"type": "specific", | ||
"evaluators": { | ||
"python": { | ||
"file": "evaluator.py" | ||
}, | ||
"java": { | ||
"file": "EvaluatorSyntaxError.java" | ||
}, | ||
"kotlin": { | ||
"file": "EvaluatorSyntaxError.kt" | ||
}, | ||
"haskell": { | ||
"file": "EvaluatorSyntaxError.hs" | ||
}, | ||
"runhaskell": { | ||
"file": "EvaluatorSyntaxError.hs" | ||
}, | ||
"csharp": { | ||
"file": "EvaluatorSyntaxError.cs" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.