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
|
||||
|
||||
describe("Module", () => {
|
||||
test("add(1,2)", () => {
|
||||
let result = evalToStringResultWithFoo("Foo.add(1,2)")
|
||||
test("add2(1,2)", () => {
|
||||
let result = evalToStringResultWithFoo("Foo.add2(1,2)")
|
||||
expect(result)->toEqual("Ok(3)")
|
||||
})
|
||||
test("add(1,2,3)", () => {
|
||||
let result = evalToStringResultWithFoo("Foo.add(1,2,3)")
|
||||
test("add3(1,2,3)", () => {
|
||||
let result = evalToStringResultWithFoo("Foo.add3(1,2,3)")
|
||||
expect(result)->toEqual("Ok(6)")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,16 +12,20 @@ describe("Fn auto-testing", () => {
|
|||
expectEvalToBeOk(r)
|
||||
})
|
||||
|
||||
// testAll(
|
||||
// "tests of type",
|
||||
// E.A.to_list(FunctionRegistry_Core.Registry.allExamplesWithFns(registry)),
|
||||
// ((fn, example)) => {
|
||||
// let responseType =
|
||||
// example
|
||||
// ->Reducer.evaluate
|
||||
// ->E.R2.fmap(ReducerInterface_InternalExpressionValue.externalValueToValueType)
|
||||
// let expectedOutputType = fn.output |> E.O.toExn("")
|
||||
// expect(responseType)->toEqual(Ok(expectedOutputType))
|
||||
// },
|
||||
// )
|
||||
testAll(
|
||||
"tests of type",
|
||||
E.A.to_list(
|
||||
FunctionRegistry_Core.Registry.allExamplesWithFns(registry)->E.A2.filter(((fn, _)) =>
|
||||
E.O.isSome(fn.output)
|
||||
),
|
||||
),
|
||||
((fn, example)) => {
|
||||
let responseType =
|
||||
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,
|
||||
~requiresNamespace=true,
|
||||
~output=EvtRecord,
|
||||
~examples=[`Dict.fromList({a: 1, b: 2})`],
|
||||
~examples=[`Dict.fromList([["a", 1], ["b", 2]])`],
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="fromList",
|
||||
|
|
|
@ -35,9 +35,10 @@ let library = [
|
|||
~name="declare",
|
||||
~nameSpace,
|
||||
~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.",
|
||||
~examples=[
|
||||
`declareFn({
|
||||
`Function.declare({
|
||||
fn: {|a,b| a },
|
||||
inputs: [
|
||||
{min: 0, max: 100},
|
||||
|
|
|
@ -60,7 +60,7 @@ let library = [
|
|||
~nameSpace,
|
||||
~requiresNamespace,
|
||||
~output=EvtNumber,
|
||||
~examples=[`ceiling(3.5)`],
|
||||
~examples=[`ceil(3.5)`],
|
||||
~definitions=[NumberToNumber.make("ceil", Js.Math.ceil_float)],
|
||||
(),
|
||||
),
|
||||
|
|
|
@ -16,8 +16,8 @@ let library = [
|
|||
~requiresNamespace,
|
||||
~output=EvtNumber,
|
||||
~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)}})",
|
||||
"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: 4.5})",
|
||||
],
|
||||
~definitions=[
|
||||
|
@ -69,7 +69,7 @@ let library = [
|
|||
~nameSpace,
|
||||
~output=EvtNumber,
|
||||
~requiresNamespace,
|
||||
~examples=["Dist.klDivergence(normal(5,2), normal(5,1.5)"],
|
||||
~examples=["Dist.klDivergence(normal(5,2), normal(5,1.5))"],
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="klDivergence",
|
||||
|
|
Loading…
Reference in New Issue
Block a user