diff --git a/packages/squiggle-lang/__tests__/FunctionRegistry_test.res b/packages/squiggle-lang/__tests__/FunctionRegistry_test.res index bfb4ab9f..d68d9b01 100644 --- a/packages/squiggle-lang/__tests__/FunctionRegistry_test.res +++ b/packages/squiggle-lang/__tests__/FunctionRegistry_test.res @@ -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)") }) }) diff --git a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res index 23e83a45..a3b73d2b 100644 --- a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res +++ b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res @@ -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)) + }, + ) }) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res index fdb8e191..4a52f187 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res @@ -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", diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res index 1e423f52..512d564a 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res @@ -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}, diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res index 10d5d1f2..6bf9ff9e 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res @@ -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)], (), ), diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res index 0ba1f5c3..d8d5ddd0 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res @@ -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",