Skip to content

Commit

Permalink
[+] v0.1.3.1
Browse files Browse the repository at this point in the history
[+] workflow
  • Loading branch information
0xMaka authored Sep 28, 2024
2 parents c30db02 + 3d71775 commit e69ba1e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
25 changes: 25 additions & 0 deletions misc/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Cargo Build & Test

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --1verbose

49 changes: 29 additions & 20 deletions tests/kwl32_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mod kwl32_util {
let expected = [[1u8;16], [0u8;16]] .concat();
assert_eq!(util::pad32r(&input), expected . as_slice());
}

#[test]
fn pad32l_less_than_32_bytes() {
let input = [1u8; 16];
Expand Down Expand Up @@ -180,40 +181,48 @@ mod kwl32_util {
assert_eq!(util::and32(&a, &b), [0u8; 32]);
}

//-----------------------------------------------------------------------------------------------//
fn or32() {
let a = [0xFFu8; 32];
let b = [0x00u8; 32];

assert_eq!(util::or32(&a, &b), a);
}

#[test]
fn not32() {
let a = [0xFFu8; 32];
assert_eq!(util::not32(&a), [0u8;32]);
}

//-------- -------- OR32 -------- --------//


//-----------------------------------------------------------------------------------------------//

//-------- -------- NOT32 -------- --------//
//-------- -------- EDGE CASES -------- --------//

// edge case:
#[test]
fn xor32_same_input() {
let a = [0xFFu8; 32];
assert_eq!(util::xor32(&a, &a), [0u8; 32]);
}

//-------- -------- XOR32 -------- --------//


//-----------------------------------------------------------------------------------------------//

//-------- -------- AND32 -------- --------//


//-----------------------------------------------------------------------------------------------//

//-------- -------- OR32 -------- --------//
#[test]
fn xor32_same_input() {
let a = [0xFFu8; 32];
assert_eq!(util::xor32(&a, &a), [0u8; 32]);
}

#[test]
fn xor32_same_input() {
let a = [0xFFu8; 32];
assert_eq!(util::and32(&a, &a), a);
}

//-----------------------------------------------------------------------------------------------//
#[test]
fn or32_same_input() {
let a = [0xFFu8; 32];
assert_eq!(util::or32(&a, &a), a);
}

//-------- -------- NOT32 -------- --------//

/*
*/
}
//-----------------------------------------------------------------------------

0 comments on commit e69ba1e

Please sign in to comment.