From 99b4ead93dc187b6bc1772577b3386a356e9267e Mon Sep 17 00:00:00 2001 From: arty Date: Fri, 4 Aug 2023 09:29:37 -0700 Subject: [PATCH] Add tests that exercise operator choice in classic run --- src/tests/classic/run.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/tests/classic/run.rs b/src/tests/classic/run.rs index c4896b909..f44876c62 100644 --- a/src/tests/classic/run.rs +++ b/src/tests/classic/run.rs @@ -1199,3 +1199,34 @@ fn test_secp256r1_verify_classic_fail() { .to_string(); assert!(output.starts_with("FAIL: secp256r1_verify failed")); } + +#[test] +fn test_classic_obeys_operator_choice_at_compile_time_no_version() { + let compiled = do_basic_run(&vec![ + "run".to_string(), + "(mod () (coinid (sha256 99) (sha256 99) 1))".to_string() + ]).trim().to_string(); + assert_eq!(compiled, "(q . 0x97c3f14ced4dfc280611fd8d9b158163e8981b3bce4d1bb6dd0bcc679a2e2455)"); +} + +#[test] +fn test_classic_obeys_operator_choice_at_compile_time_version_1() { + let compiled = do_basic_run(&vec![ + "run".to_string(), + "--operators-version".to_string(), + "1".to_string(), + "(mod () (coinid (sha256 99) (sha256 99) 1))".to_string() + ]).trim().to_string(); + assert_eq!(compiled, "(q . 0x97c3f14ced4dfc280611fd8d9b158163e8981b3bce4d1bb6dd0bcc679a2e2455)"); +} + +#[test] +fn test_classic_obeys_operator_choice_at_compile_time_version_0() { + let compiled = do_basic_run(&vec![ + "run".to_string(), + "--operators-version".to_string(), + "0".to_string(), + "(mod () (coinid (sha256 99) (sha256 99) 1))".to_string() + ]).trim().to_string(); + assert_eq!(compiled, "FAIL: unimplemented operator 48"); +}