mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-25 02:22:44 +03:00
rebase and replace const keyword in tests
This commit is contained in:
parent
42bea9e93a
commit
d549fda7b5
@ -1,4 +1,4 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
let a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (2, 3)] = [[0; 3]; 2]; // initializer
|
||||
let b: [u8; (2, 3)] = [[0; 3]; 2]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (2, 3)] = [0; (2, 3)]; // initializer
|
||||
let b: [u8; (2, 3)] = [0; (2, 3)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)
|
||||
let b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)
|
||||
}
|
@ -3,6 +3,6 @@ function foo() -> field {
|
||||
}
|
||||
|
||||
function main() {
|
||||
const myGlobal = 42field;
|
||||
let myGlobal = 42field;
|
||||
let err = foo();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// Constant variables are immutable by default.
|
||||
// Let variables are immutable by default.
|
||||
function main() {
|
||||
const a = 1u32;
|
||||
let a = 1u32;
|
||||
a = 0;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// Adding the `mut` keyword to a constant variable is illegal
|
||||
function main() {
|
||||
const mut a = 1u32;
|
||||
}
|
@ -28,12 +28,6 @@ fn test_const_fail() {
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_mut_fail() {
|
||||
let program_string = include_str!("const_mut.leo");
|
||||
load_asg(program_string).err().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array() {
|
||||
let program_string = include_str!("array.leo");
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)];
|
||||
let a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)];
|
||||
|
||||
const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2];
|
||||
let b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2];
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
|
||||
const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
let b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
|
||||
const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
let b: [u32; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(a: [[u8; 2]; 3]) {
|
||||
const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(a: [[[u8; 2]; 3]; 4]) {
|
||||
const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer
|
||||
let b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer
|
||||
let b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer
|
||||
let b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer
|
||||
let b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
let b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer
|
||||
let b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
let b: [u8; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer
|
||||
let b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// !(true && (false || true))
|
||||
function main() {
|
||||
const a = true;
|
||||
const b = false || a;
|
||||
const c = !(true && b);
|
||||
let a = true;
|
||||
let b = false || a;
|
||||
let c = !(true && b);
|
||||
|
||||
console.assert(c == false);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
|
||||
let point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
|
||||
}
|
@ -12,15 +12,15 @@ import bar.( // imports directory import
|
||||
import car.Car; // imports directory import
|
||||
|
||||
function main() {
|
||||
const point = Point { x: 1u32, y: 1u32 };
|
||||
const foo = foo();
|
||||
let point = Point { x: 1u32, y: 1u32 };
|
||||
let foo = foo();
|
||||
|
||||
const bar = Bar { r: 1u32 };
|
||||
const baz = Baz { z: 1u32 };
|
||||
const bazzar = Bazzar { a: 1u32 };
|
||||
const bat = Bat { t: 1u32 };
|
||||
let bar = Bar { r: 1u32 };
|
||||
let baz = Baz { z: 1u32 };
|
||||
let bazzar = Bazzar { a: 1u32 };
|
||||
let bat = Bat { t: 1u32 };
|
||||
|
||||
const car = Car { c: 1u32 };
|
||||
let car = Car { c: 1u32 };
|
||||
|
||||
console.assert(car.c == 1u32);
|
||||
}
|
@ -6,14 +6,14 @@ import bar.bat.bat.*; // imports directory import
|
||||
import car.*; // imports directory import
|
||||
|
||||
function main() {
|
||||
const point = Point { x: 1u32, y: 1u32 };
|
||||
const foo = foo();
|
||||
let point = Point { x: 1u32, y: 1u32 };
|
||||
let foo = foo();
|
||||
|
||||
const bar = Bar { r: 1u32 };
|
||||
const bat = Bat { t: 1u32 };
|
||||
const baz = Baz { z: 1u32 };
|
||||
let bar = Bar { r: 1u32 };
|
||||
let bat = Bat { t: 1u32 };
|
||||
let baz = Baz { z: 1u32 };
|
||||
|
||||
const car = Car { c: 1u32 };
|
||||
let car = Car { c: 1u32 };
|
||||
|
||||
console.assert(car.c == 1u32);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(a: bool, b: bool) {
|
||||
let c = if a ? true : false;
|
||||
|
||||
const d = c == b;
|
||||
let d = c == b;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)];
|
||||
let a: [u8; (2, 2, 2)] = [1u8; (2, 2, 2)];
|
||||
|
||||
const b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2];
|
||||
let b: [u8; (2, 2, 2)] = [[[1u8; 2]; 2]; 2];
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
|
||||
const b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
let b: [u32; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let a: [u32; (3, 2)] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
let a = [[0u32, 0u32], [0u32, 0u32], [0u32, 0u32]]; // inline
|
||||
|
||||
const b: [u32; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
let b: [u32; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// Multidimensional array syntax in leo
|
||||
function main() {
|
||||
const a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
let a: [u32; (3, 2)] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
function main(a: [[u8; 2]; 3]) {
|
||||
const b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let b = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(a: [[[u8; 2]; 3]; 4]) {
|
||||
const b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let b = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer
|
||||
let b: [[u8; 2]; 3] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[u8; 2]; 3] = [[0; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer
|
||||
let b: [[[u8; 2]; 3]; 4] = [[[0; 2]; 3]; 4]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[[u8; 2]; 3]; 4] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer
|
||||
let b: [[u8; 2]; 3] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[u8; 2]; 3] = [0; (2, 3)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer
|
||||
let b: [[[u8; 2]; 3]; 4] = [0; (4, 3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [[[u8; 2]; 3]; 4] = [0; (2, 3, 4)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
let b: [u8; (3, 2)] = [[0; 2]; 3]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (2, 3)] = [[0; 2]; 3]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer
|
||||
let b: [u8; (4, 3, 2)] = [[[0; 2]; 3]; 4]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (4, 3, 2)] = [[[0; 4]; 3]; 2]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main() {
|
||||
const a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
let a = [[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]; // inline
|
||||
|
||||
const b: [u8; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
let b: [u8; (3, 2)] = [0; (3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)
|
||||
let b: [u8; (2, 3)] = [0; (3, 2)]; // initializer (incorrectly reversed ordering)
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
function main() {
|
||||
const a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
let a = [[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]],
|
||||
[[0u8, 0u8], [0u8, 0u8], [0u8, 0u8]]]; // inline
|
||||
|
||||
const b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer
|
||||
let b: [u8; (4, 3, 2)] = [0; (4, 3, 2)]; // initializer
|
||||
|
||||
console.assert(a == b);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)
|
||||
let b: [u8; (4, 3, 2)] = [0; (2, 3, 4)]; // initializer (incorrectly reversed order)
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
// !(true && (false || true))
|
||||
function main() {
|
||||
const a = true;
|
||||
const b = false || a;
|
||||
const c = !(true && b);
|
||||
let a = true;
|
||||
let b = false || a;
|
||||
let c = !(true && b);
|
||||
|
||||
console.assert(c == false);
|
||||
}
|
@ -8,6 +8,6 @@ circuit Bar {
|
||||
|
||||
function main () {
|
||||
let Bar = 66u32;
|
||||
const k1 = Bar{ b2: 30u32 };
|
||||
const k2 = Bar::add_five(55u32);
|
||||
let k1 = Bar{ b2: 30u32 };
|
||||
let k2 = Bar::add_five(55u32);
|
||||
}
|
@ -3,6 +3,6 @@ function foo() -> field {
|
||||
}
|
||||
|
||||
function main() {
|
||||
const myGlobal = 42field;
|
||||
let myGlobal = 42field;
|
||||
let err = foo();
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
|
||||
let point = (7374112779530666882856915975292384652154477718021969292781165691637980424078, 3435195339177955418892975564890903138308061187980579490487898366607011481796)group;
|
||||
}
|
@ -12,15 +12,15 @@ import bar.( // imports directory import
|
||||
import car.Car; // imports directory import
|
||||
|
||||
function main() {
|
||||
const point = Point { x: 1u32, y: 1u32 };
|
||||
const foo = foo();
|
||||
let point = Point { x: 1u32, y: 1u32 };
|
||||
let foo = foo();
|
||||
|
||||
const bar = Bar { r: 1u32 };
|
||||
const baz = Baz { z: 1u32 };
|
||||
const bazzar = Bazzar { a: 1u32 };
|
||||
const bat = Bat { t: 1u32 };
|
||||
let bar = Bar { r: 1u32 };
|
||||
let baz = Baz { z: 1u32 };
|
||||
let bazzar = Bazzar { a: 1u32 };
|
||||
let bat = Bat { t: 1u32 };
|
||||
|
||||
const car = Car { c: 1u32 };
|
||||
let car = Car { c: 1u32 };
|
||||
|
||||
console.assert(car.c == 1u32);
|
||||
}
|
@ -6,14 +6,14 @@ import bar.bat.bat.*; // imports directory import
|
||||
import car.*; // imports directory import
|
||||
|
||||
function main() {
|
||||
const point = Point { x: 1u32, y: 1u32 };
|
||||
const foo = foo();
|
||||
let point = Point { x: 1u32, y: 1u32 };
|
||||
let foo = foo();
|
||||
|
||||
const bar = Bar { r: 1u32 };
|
||||
const bat = Bat { t: 1u32 };
|
||||
const baz = Baz { z: 1u32 };
|
||||
let bar = Bar { r: 1u32 };
|
||||
let bat = Bat { t: 1u32 };
|
||||
let baz = Baz { z: 1u32 };
|
||||
|
||||
const car = Car { c: 1u32 };
|
||||
let car = Car { c: 1u32 };
|
||||
|
||||
console.assert(car.c == 1u32);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// Constant variables are immutable by default.
|
||||
// Let variables are immutable by default.
|
||||
function main() {
|
||||
const a = 1u32;
|
||||
let a = 1u32;
|
||||
a = 0;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// Adding the `mut` keyword to a constant variable is illegal
|
||||
function main() {
|
||||
const mut a = 1u32;
|
||||
}
|
@ -49,14 +49,6 @@ fn test_const_fail() {
|
||||
expect_asg_error(error);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_const_mut_fail() {
|
||||
let program_string = include_str!("const_mut.leo");
|
||||
let error = parse_program(program_string).err().unwrap();
|
||||
|
||||
expect_asg_error(error);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_array() {
|
||||
let program_string = include_str!("array.leo");
|
||||
|
@ -1,5 +1,5 @@
|
||||
function main(a: bool, b: bool) {
|
||||
let c = if a ? true : false;
|
||||
|
||||
const d = c == b;
|
||||
let d = c == b;
|
||||
}
|
@ -19,8 +19,8 @@ circuit PedersenHash {
|
||||
|
||||
// The 'pedersen-hash' main function.
|
||||
function main() -> group {
|
||||
const parameters = [1group; 256];
|
||||
const pedersen = PedersenHash::new(parameters);
|
||||
let parameters = [1group; 256];
|
||||
let pedersen = PedersenHash::new(parameters);
|
||||
let hash_input: [bool; 256] = [true; 256];
|
||||
return pedersen.hash(hash_input)
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ circuit PedersenHash {
|
||||
|
||||
// The 'pedersen-hash' main function.
|
||||
function main() -> group {
|
||||
const parameters = [1group; 256];
|
||||
const pedersen = PedersenHash::new(parameters);
|
||||
let parameters = [1group; 256];
|
||||
let pedersen = PedersenHash::new(parameters);
|
||||
let hash_input: [bool; 256] = [true; 256];
|
||||
return pedersen.hash(hash_input)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user