From 40055dc45dedd89e15e9afbdb7e1a41c41c16459 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Fri, 23 Jul 2021 15:11:42 -0700 Subject: [PATCH] basic tests --- src/gates/exponentiation.rs | 26 +++++++++++--------------- src/gates/insertion.rs | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gates/exponentiation.rs b/src/gates/exponentiation.rs index 30650590..410d52c8 100644 --- a/src/gates/exponentiation.rs +++ b/src/gates/exponentiation.rs @@ -176,33 +176,29 @@ mod tests { use crate::field::field::Field; use crate::gates::gate::Gate; use crate::gates::gate_testing::test_low_degree; - use crate::gates::insertion::ExponentiationGate; + use crate::gates::exponentiation::ExponentiationGate; use crate::proof::Hash; use crate::vars::EvaluationVars; #[test] fn wire_indices() { let gate = ExponentiationGate:: { - vec_size: 3, + num_power_bits: 5, _phantom: PhantomData, }; - assert_eq!(gate.wires_insertion_index(), 0); - assert_eq!(gate.wires_element_to_insert(), 1..5); - assert_eq!(gate.wires_original_list_item(0), 5..9); - assert_eq!(gate.wires_original_list_item(2), 13..17); - assert_eq!(gate.wires_output_list_item(0), 17..21); - assert_eq!(gate.wires_output_list_item(3), 29..33); - assert_eq!(gate.wires_equality_dummy_for_round_r(0), 33); - assert_eq!(gate.wires_equality_dummy_for_round_r(3), 36); - assert_eq!(gate.wires_insert_here_for_round_r(0), 37); - assert_eq!(gate.wires_insert_here_for_round_r(3), 40); + assert_eq!(gate.wires_base(), 0); + assert_eq!(gate.wires_power(), 1); + assert_eq!(gate.wires_power_bit(0), 2); + assert_eq!(gate.wires_power_bit(4), 6); + assert_eq!(gate.wires_intermediate_value(0), 7); + assert_eq!(gate.wires_intermediate_value(0), 11); } #[test] fn low_degree() { type F = CrandallField; - test_low_degree(ExponentiationGate::::new(4)); + test_low_degree(ExponentiationGate::::new(5)); } #[test] @@ -211,8 +207,8 @@ mod tests { type FF = QuarticCrandallField; const D: usize = 4; - /// Returns the local wires for an insertion gate for given the original vector, element to - /// insert, and index. + /// Returns the local wires for an exponentiation gate given the base, power, and power bit + /// values. fn get_wires(orig_vec: Vec, insertion_index: usize, element_to_insert: FF) -> Vec { let vec_size = orig_vec.len(); diff --git a/src/gates/insertion.rs b/src/gates/insertion.rs index 1bc0b454..245db852 100644 --- a/src/gates/insertion.rs +++ b/src/gates/insertion.rs @@ -322,7 +322,7 @@ mod tests { type FF = QuarticCrandallField; const D: usize = 4; - /// Returns the local wires for an insertion gate for given the original vector, element to + /// Returns the local wires for an insertion gate given the original vector, element to /// insert, and index. fn get_wires(orig_vec: Vec, insertion_index: usize, element_to_insert: FF) -> Vec { let vec_size = orig_vec.len();