Skip to content

Commit 2a9626f

Browse files
committed
Add test for quad_bit with m == 0
1 parent b220d96 commit 2a9626f

File tree

1 file changed

+24
-1
lines changed
  • vm/src/hint_processor/builtin_hint_processor/secp

1 file changed

+24
-1
lines changed

vm/src/hint_processor/builtin_hint_processor/secp/ec_utils.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ mod tests {
13291329
}
13301330

13311331
#[test]
1332-
fn run_quad_bit_for_m_1() {
1332+
fn run_quad_bit_for_m_1_ok() {
13331333
let hint_code = hint_code::QUAD_BIT;
13341334
let mut vm = vm_with_range_check!();
13351335

@@ -1351,6 +1351,29 @@ mod tests {
13511351
check_memory![vm.segments.memory, ((1, 3), 0)];
13521352
}
13531353

1354+
#[test]
1355+
fn run_quad_bit_for_m_0() {
1356+
let hint_code = hint_code::QUAD_BIT;
1357+
let mut vm = vm_with_range_check!();
1358+
1359+
let scalar_u = 0b1010101;
1360+
let scalar_v = 0b1010101;
1361+
let m = 0;
1362+
// Insert ids.scalar into memory
1363+
vm.segments = segments![((1, 0), scalar_u), ((1, 1), scalar_v), ((1, 2), m)];
1364+
1365+
// Initialize RunContext
1366+
run_context!(vm, 0, 4, 4);
1367+
1368+
let ids_data = ids_data!["scalar_u", "scalar_v", "m", "quad_bit"];
1369+
1370+
// Execute the hint
1371+
assert_matches!(
1372+
run_hint!(vm, ids_data, hint_code),
1373+
Err(HintError::NPairBitsTooLowM)
1374+
);
1375+
}
1376+
13541377
#[test]
13551378
fn run_quad_bit_with_max_m_ok() {
13561379
let hint_code = hint_code::QUAD_BIT;

0 commit comments

Comments
 (0)