impl tests for group notation

This commit is contained in:
collin 2020-08-15 16:31:07 -07:00
parent 3fe25da23f
commit 37bedc8662
12 changed files with 103 additions and 22 deletions

View File

@ -0,0 +1,3 @@
function main() {
let element = (+, +)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (_, _)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (-, -)group;
}

View File

@ -1,5 +1,6 @@
use crate::{
assert_satisfied,
expect_compiler_error,
expect_synthesis_error,
field::field_to_decimal_string,
generate_main_input,
@ -20,22 +21,6 @@ pub fn group_to_decimal_string(g: EdwardsAffine) -> String {
format!("({}, {})", x, y)
}
#[test]
fn test_zero() {
let bytes = include_bytes!("zero.leo");
let program = parse_program(bytes).unwrap();
assert_satisfied(program);
}
#[test]
fn test_one() {
let bytes = include_bytes!("one.leo");
let program = parse_program(bytes).unwrap();
assert_satisfied(program)
}
#[test]
fn test_point() {
let bytes = include_bytes!("point.leo");
@ -44,6 +29,81 @@ fn test_point() {
assert_satisfied(program);
}
#[test]
fn test_x_sign_high() {
let bytes = include_bytes!("x_sign_high.leo");
let program = parse_program(bytes).unwrap();
assert_satisfied(program);
}
#[test]
fn test_x_sign_low() {
let bytes = include_bytes!("x_sign_low.leo");
let program = parse_program(bytes).unwrap();
assert_satisfied(program);
}
#[test]
fn test_x_sign_inferred() {
let bytes = include_bytes!("x_sign_inferred.leo");
let program = parse_program(bytes).unwrap();
assert_satisfied(program);
}
// #[test]
// fn test_y_sign_high() {
// let bytes = include_bytes!("y_sign_high.leo");
// let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program);
// }
//
// #[test]
// fn test_y_sign_low() {
// let bytes = include_bytes!("y_sign_low.leo");
// let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program);
// }
//
// #[test]
// fn test_y_sign_inferred() {
// let bytes = include_bytes!("y_sign_inferred.leo");
// let program = parse_program(bytes).unwrap();
//
// assert_satisfied(program);
// }
#[test]
fn test_double_high() {
let bytes = include_bytes!("double_high.leo");
let program = parse_program(bytes).unwrap();
expect_compiler_error(program);
}
#[test]
fn test_double_low() {
let bytes = include_bytes!("double_low.leo");
let program = parse_program(bytes).unwrap();
expect_compiler_error(program);
}
#[test]
fn test_double_inferred() {
let bytes = include_bytes!("double_inferred.leo");
let program = parse_program(bytes).unwrap();
expect_compiler_error(program);
}
#[test]
fn test_point_input() {
let program_bytes = include_bytes!("point_input.leo");

View File

@ -1,3 +0,0 @@
function main() {
let a = 1group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (0, +)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (0, _)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (0, -)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (+, 1)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (_, 1)group;
}

View File

@ -0,0 +1,3 @@
function main() {
let element = (-, 1)group;
}

View File

@ -1,3 +0,0 @@
function main() {
let a = 0group;
}