Skip to content

Commit a1a7720

Browse files
committed
feat(zkevm-circuits): add version constants
1 parent 486a31c commit a1a7720

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

zkevm-circuits/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#![deny(unsafe_code)]
1919
#![deny(clippy::debug_assert_with_mut_call)]
2020

21+
pub mod version;
2122
pub mod bytecode_circuit;
2223
pub mod copy_circuit;
2324
pub mod evm_circuit;

zkevm-circuits/src/version.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// Version
2+
pub mod version {
3+
/// Major version
4+
pub const MAJOR: u32 = 0;
5+
/// Minor version
6+
pub const MINOR: u32 = 1;
7+
/// Patch version
8+
pub const PATCH: u32 = 0;
9+
10+
/// Export versions as string
11+
pub fn as_string() -> String {
12+
format!("{}.{}.{}", MAJOR, MINOR, PATCH)
13+
}
14+
}
15+
16+
mod tests {
17+
use crate::version::version;
18+
19+
#[test]
20+
fn test_version_string() {
21+
let expected = "0.1.0";
22+
23+
assert_eq!(version::MAJOR, 0, "wrong version");
24+
assert_eq!(version::MINOR, 1, "wrong version");
25+
assert_eq!(version::PATCH, 0, "wrong version");
26+
assert_eq!(version::as_string(), expected, "wrong version");
27+
}
28+
}

0 commit comments

Comments
 (0)