All autogenerated FunctionLibrary tests pass
This commit is contained in:
parent
395477ed12
commit
c5447b8d7a
|
@ -67,12 +67,12 @@ let evalToStringResultWithFoo = sourceCode =>
|
||||||
evalWithFoo(sourceCode)->InternalExpressionValue.toStringResult
|
evalWithFoo(sourceCode)->InternalExpressionValue.toStringResult
|
||||||
|
|
||||||
describe("Module", () => {
|
describe("Module", () => {
|
||||||
test("add(1,2)", () => {
|
test("add2(1,2)", () => {
|
||||||
let result = evalToStringResultWithFoo("Foo.add(1,2)")
|
let result = evalToStringResultWithFoo("Foo.add2(1,2)")
|
||||||
expect(result)->toEqual("Ok(3)")
|
expect(result)->toEqual("Ok(3)")
|
||||||
})
|
})
|
||||||
test("add(1,2,3)", () => {
|
test("add3(1,2,3)", () => {
|
||||||
let result = evalToStringResultWithFoo("Foo.add(1,2,3)")
|
let result = evalToStringResultWithFoo("Foo.add3(1,2,3)")
|
||||||
expect(result)->toEqual("Ok(6)")
|
expect(result)->toEqual("Ok(6)")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -12,16 +12,20 @@ describe("Fn auto-testing", () => {
|
||||||
expectEvalToBeOk(r)
|
expectEvalToBeOk(r)
|
||||||
})
|
})
|
||||||
|
|
||||||
// testAll(
|
testAll(
|
||||||
// "tests of type",
|
"tests of type",
|
||||||
// E.A.to_list(FunctionRegistry_Core.Registry.allExamplesWithFns(registry)),
|
E.A.to_list(
|
||||||
// ((fn, example)) => {
|
FunctionRegistry_Core.Registry.allExamplesWithFns(registry)->E.A2.filter(((fn, _)) =>
|
||||||
// let responseType =
|
E.O.isSome(fn.output)
|
||||||
// example
|
),
|
||||||
// ->Reducer.evaluate
|
),
|
||||||
// ->E.R2.fmap(ReducerInterface_InternalExpressionValue.externalValueToValueType)
|
((fn, example)) => {
|
||||||
// let expectedOutputType = fn.output |> E.O.toExn("")
|
let responseType =
|
||||||
// expect(responseType)->toEqual(Ok(expectedOutputType))
|
example
|
||||||
// },
|
->Reducer.evaluate
|
||||||
// )
|
->E.R2.fmap(ReducerInterface_InternalExpressionValue.externalValueToValueType)
|
||||||
|
let expectedOutputType = fn.output |> E.O.toExn("")
|
||||||
|
expect(responseType)->toEqual(Ok(expectedOutputType))
|
||||||
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
|
@ -151,7 +151,7 @@ let library = [
|
||||||
~nameSpace,
|
~nameSpace,
|
||||||
~requiresNamespace=true,
|
~requiresNamespace=true,
|
||||||
~output=EvtRecord,
|
~output=EvtRecord,
|
||||||
~examples=[`Dict.fromList({a: 1, b: 2})`],
|
~examples=[`Dict.fromList([["a", 1], ["b", 2]])`],
|
||||||
~definitions=[
|
~definitions=[
|
||||||
FnDefinition.make(
|
FnDefinition.make(
|
||||||
~name="fromList",
|
~name="fromList",
|
||||||
|
|
|
@ -35,9 +35,10 @@ let library = [
|
||||||
~name="declare",
|
~name="declare",
|
||||||
~nameSpace,
|
~nameSpace,
|
||||||
~requiresNamespace=true,
|
~requiresNamespace=true,
|
||||||
|
~output=EvtDeclaration,
|
||||||
~description="Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within.",
|
~description="Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within.",
|
||||||
~examples=[
|
~examples=[
|
||||||
`declareFn({
|
`Function.declare({
|
||||||
fn: {|a,b| a },
|
fn: {|a,b| a },
|
||||||
inputs: [
|
inputs: [
|
||||||
{min: 0, max: 100},
|
{min: 0, max: 100},
|
||||||
|
|
|
@ -60,7 +60,7 @@ let library = [
|
||||||
~nameSpace,
|
~nameSpace,
|
||||||
~requiresNamespace,
|
~requiresNamespace,
|
||||||
~output=EvtNumber,
|
~output=EvtNumber,
|
||||||
~examples=[`ceiling(3.5)`],
|
~examples=[`ceil(3.5)`],
|
||||||
~definitions=[NumberToNumber.make("ceil", Js.Math.ceil_float)],
|
~definitions=[NumberToNumber.make("ceil", Js.Math.ceil_float)],
|
||||||
(),
|
(),
|
||||||
),
|
),
|
||||||
|
|
|
@ -16,8 +16,8 @@ let library = [
|
||||||
~requiresNamespace,
|
~requiresNamespace,
|
||||||
~output=EvtNumber,
|
~output=EvtNumber,
|
||||||
~examples=[
|
~examples=[
|
||||||
"Dist.logScore({estimate: normal(5,2), answer: normal(5.2,1)}, prior: normal(5.5,3)})",
|
"Dist.logScore({estimate: normal(5,2), answer: normal(5.2,1), prior: normal(5.5,3)})",
|
||||||
"Dist.logScore({estimate: normal(5,2), answer: normal(5.2,1)}})",
|
"Dist.logScore({estimate: normal(5,2), answer: normal(5.2,1)})",
|
||||||
"Dist.logScore({estimate: normal(5,2), answer: 4.5})",
|
"Dist.logScore({estimate: normal(5,2), answer: 4.5})",
|
||||||
],
|
],
|
||||||
~definitions=[
|
~definitions=[
|
||||||
|
@ -69,7 +69,7 @@ let library = [
|
||||||
~nameSpace,
|
~nameSpace,
|
||||||
~output=EvtNumber,
|
~output=EvtNumber,
|
||||||
~requiresNamespace,
|
~requiresNamespace,
|
||||||
~examples=["Dist.klDivergence(normal(5,2), normal(5,1.5)"],
|
~examples=["Dist.klDivergence(normal(5,2), normal(5,1.5))"],
|
||||||
~definitions=[
|
~definitions=[
|
||||||
FnDefinition.make(
|
FnDefinition.make(
|
||||||
~name="klDivergence",
|
~name="klDivergence",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user