From 7197e4eb2378b70ffab572349dc2c4ef8aec05c2 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 28 Oct 2025 16:51:37 -0400 Subject: [PATCH] test cases --- .../index_page/signature/signature_h.rs | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/crates/api_clients/grok_client/src/requests/index_page/signature/signature_h.rs b/crates/api_clients/grok_client/src/requests/index_page/signature/signature_h.rs index cb5dfedaba..f119ac7021 100644 --- a/crates/api_clients/grok_client/src/requests/index_page/signature/signature_h.rs +++ b/crates/api_clients/grok_client/src/requests/index_page/signature/signature_h.rs @@ -49,6 +49,7 @@ pub fn signature_h(x: f64, param: f64, c: f64, e: bool) -> Result + // _h._param 0 + // _h.c 1 + // _h.e False + // + // Python Outputs: + // + // _h.f 0.050980392156862744 + // _h.rounded 0.05 + + let x = 13.0; // NB: This was an int in python + let param = 0.0; // NB: This was an int in python + let c = 1.0; // NB: This was an int in python + let e = false; + + let observed = signature_h(x, param, c, e).unwrap(); + + let expected = 0.05; + + assert_eq!(expected, observed); + } + + #[test] + fn test_2() { + // Actual test case, called in loop: + // cp = [Signature._h(v, -1 if (i % 2) else 0, 1, False) for i, v in enumerate(values[7:])] + // Python Inputs: + // + // _h.x 13 + // _h._param 0 + // _h.c 1 + // _h.e False + // + // Python Outputs: + // + // _h.f 0.050980392156862744 + // _h.rounded 0.05 + + let x = 13.0; // NB: This was an int in python + let param = 0.0; // NB: This was an int in python + let c = 1.0; // NB: This was an int in python + let e = false; + + let observed = signature_h(x, param, c, e).unwrap(); + + let expected = 0.05; + + assert_eq!(expected, observed); + } }