Turned error into actual error
This commit is contained in:
parent
1102ceb4ec
commit
51e2cf167c
|
@ -88,10 +88,13 @@ describe("eval on distribution functions", () => {
|
||||||
|
|
||||||
describe("log", () => {
|
describe("log", () => {
|
||||||
testEval("log(2, uniform(5,8))", "Ok(Sample Set Distribution)")
|
testEval("log(2, uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||||
testEval("log(normal(5,2), 3)", "Error(Distribution Math Error: Argument Error First input of logarithm must be fully greater than 0)")
|
testEval(
|
||||||
|
"log(normal(5,2), 3)",
|
||||||
|
"Error(Distribution Math Error: Logarithm of input error: First input must completely greater than 0)",
|
||||||
|
)
|
||||||
testEval(
|
testEval(
|
||||||
"log(normal(5,2), normal(10,1))",
|
"log(normal(5,2), normal(10,1))",
|
||||||
"Error(Distribution Math Error: Argument Error First input of logarithm must be fully greater than 0)",
|
"Error(Distribution Math Error: Logarithm of input error: First input must completely greater than 0)",
|
||||||
)
|
)
|
||||||
testEval("log(uniform(5,8))", "Ok(Sample Set Distribution)")
|
testEval("log(uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||||
testEval("log10(uniform(5,8))", "Ok(Sample Set Distribution)")
|
testEval("log10(uniform(5,8))", "Ok(Sample Set Distribution)")
|
||||||
|
|
|
@ -14,6 +14,7 @@ type error =
|
||||||
| OperationError(Operation.Error.t)
|
| OperationError(Operation.Error.t)
|
||||||
| PointSetConversionError(SampleSetDist.pointsetConversionError)
|
| PointSetConversionError(SampleSetDist.pointsetConversionError)
|
||||||
| SparklineError(PointSetTypes.sparklineError) // This type of error is for when we find a sparkline of a discrete distribution. This should probably at some point be actually implemented
|
| SparklineError(PointSetTypes.sparklineError) // This type of error is for when we find a sparkline of a discrete distribution. This should probably at some point be actually implemented
|
||||||
|
| LogarithmOfDistributionError(string)
|
||||||
| OtherError(string)
|
| OtherError(string)
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
|
@ -29,6 +30,7 @@ module Error = {
|
||||||
| Unreachable => "Unreachable"
|
| Unreachable => "Unreachable"
|
||||||
| DistributionVerticalShiftIsInvalid => "Distribution Vertical Shift is Invalid"
|
| DistributionVerticalShiftIsInvalid => "Distribution Vertical Shift is Invalid"
|
||||||
| ArgumentError(s) => `Argument Error ${s}`
|
| ArgumentError(s) => `Argument Error ${s}`
|
||||||
|
| LogarithmOfDistributionError(s) => `Logarithm of input error: ${s}`
|
||||||
| TooFewSamples => "Too Few Samples"
|
| TooFewSamples => "Too Few Samples"
|
||||||
| OperationError(err) => Operation.Error.toString(err)
|
| OperationError(err) => Operation.Error.toString(err)
|
||||||
| PointSetConversionError(err) => SampleSetDist.pointsetConversionErrorToString(err)
|
| PointSetConversionError(err) => SampleSetDist.pointsetConversionErrorToString(err)
|
||||||
|
|
|
@ -207,9 +207,10 @@ module AlgebraicCombination = {
|
||||||
])
|
])
|
||||||
switch items {
|
switch items {
|
||||||
| Error(r) => Some(r)
|
| Error(r) => Some(r)
|
||||||
| Ok([true, _]) => Some(ArgumentError("First input of logarithm must be fully greater than 0"))
|
| Ok([true, _]) =>
|
||||||
|
Some(LogarithmOfDistributionError("First input must completely greater than 0"))
|
||||||
| Ok([false, true]) =>
|
| Ok([false, true]) =>
|
||||||
Some(ArgumentError("Second input of logarithm must be fully greater than 0"))
|
Some(LogarithmOfDistributionError("Second input must completely greater than 0"))
|
||||||
| Ok([false, false]) => None
|
| Ok([false, false]) => None
|
||||||
| Ok(_) => Some(Unreachable)
|
| Ok(_) => Some(Unreachable)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user