diff --git a/haskell/Tests/RoundTrip.hs b/haskell/Tests/RoundTrip.hs index aa34117f..7bc6d54a 100644 --- a/haskell/Tests/RoundTrip.hs +++ b/haskell/Tests/RoundTrip.hs @@ -218,7 +218,8 @@ testStdChiSqRelations = test [ testCauchyRelations :: Test testCauchyRelations = test [ "t_cauchy_add_transformation" ~: testConcreteFiles "tests/RoundTrip2/t_cauchy_add_transformation.0.hk" "tests/RoundTrip2/t_cauchy_add_transformation.expected.hk", - "t_cauchy_sub_transformation" ~: testConcreteFiles "tests/RoundTrip2/t_cauchy_sub_transformation.0.hk" "tests/RoundTrip2/t_cauchy_sub_transformation.expected.hk" + "t_cauchy_sub_transformation" ~: testConcreteFiles "tests/RoundTrip2/t_cauchy_sub_transformation.0.hk" "tests/RoundTrip2/t_cauchy_sub_transformation.expected.hk", + "t_cauchy_linear_transformation" ~: testConcreteFiles "tests/RoundTrip/t_cauchy_linear_transformation.0.hk" "tests/RoundTrip/t_cauchy_linear_transformation.expected.hk" ] testExponentialRelations :: Test diff --git a/tests/RoundTrip/t_cauchy_linear_transformation.0.hk b/tests/RoundTrip/t_cauchy_linear_transformation.0.hk new file mode 100644 index 00000000..a7f71cad --- /dev/null +++ b/tests/RoundTrip/t_cauchy_linear_transformation.0.hk @@ -0,0 +1,15 @@ +def stdNormal(): + p <~ normal(0, 1) + return p + +def stdCauchy(): + X1 <~ stdNormal() + X2 <~ stdNormal() + return X1/X2 + +def cauchy(a real, alpha prob): + X <~ stdCauchy() + return a + alpha*X + +X <~ cauchy(2, 1) +return 2*X + 3 \ No newline at end of file diff --git a/tests/RoundTrip/t_cauchy_linear_transformation.expected.hk b/tests/RoundTrip/t_cauchy_linear_transformation.expected.hk new file mode 100644 index 00000000..071066be --- /dev/null +++ b/tests/RoundTrip/t_cauchy_linear_transformation.expected.hk @@ -0,0 +1,4 @@ +# cauchy(7, 2) +X1 <~ normal(+0/1, 1/1) +X2 <~ normal(+0/1, 1/1) +return (X1 * (+2/1) + X2 * (+7/1)) / X2 \ No newline at end of file