Compare commits

..

No commits in common. "d58207cb5dc29a0a2188686877b014bc6f66a508" and "222d248fabdce689b7f16ce4358977bb4bb1c355" have entirely different histories.

5 changed files with 15 additions and 23 deletions

View file

@ -31,15 +31,13 @@ jobs:
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
cat ~/.cargo/config.toml
- name: cargo clippy check
run: cargo clippy --all-features --all-targets --workspace
run: cargo clippy --all-features --all-targets
- name: cargo clippy fix
run: cargo clippy --fix --all-features --all-targets --workspace
run: cargo clippy --fix --all-features --all-targets
- name: cargo fmt
run: cargo fmt --all
- name: install python
run: apt update && apt install libpython3-dev -y
- name: cargo test
run: cargo test --all-features --all-targets --workspace
run: cargo test --all-features --all-targets
- name: commit back to repository
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
with:

View file

@ -32,15 +32,13 @@ jobs:
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
cat ~/.cargo/config.toml
- name: cargo clippy check
run: cargo clippy --all-features --all-targets --workspace
run: cargo clippy --all-features --all-targets
- name: cargo clippy fix
run: cargo clippy --fix --all-features --all-targets --workspace
run: cargo clippy --fix --all-features --all-targets
- name: cargo fmt
run: cargo fmt --all
- name: install python
run: apt update && apt install libpython3-dev -y
- name: cargo test
run: cargo test --all-features --all-targets --workspace
run: cargo test --all-features --all-targets
- name: commit back to repository
uses: stefanzweifel/git-auto-commit-action@v5
with:

View file

@ -8,12 +8,11 @@ pub use num_traits::{PrimInt, ToPrimitive};
/// ### Arguments
/// * `data` - The data you are trying to dump
pub fn bytes_to_bin(data: &[u8]) -> String {
let mut s = String::new();
for (i, dat) in data.iter().enumerate() {
if i == 0 {
s.push_str(&format!("0b{:08b}", dat));
} else {
let mut s = format!("0b{:08b}", data.first().unwrap());
for dat in data {
s.push_str(&format!("_{:08b}", dat));
if dat % 8 == 0 {
s.push('\n')
}
}
s

View file

@ -6,10 +6,6 @@ fn btobin() {
let data = [19, 19];
let r = bytes_to_bin(&data);
assert_eq!(r, format!("0b00010011_00010011"));
let data = [0xff, 0xff];
let r = bytes_to_bin(&data);
assert_eq!(r, format!("0b11111111_11111111"));
}
#[test]
@ -19,7 +15,9 @@ fn big_btobin() {
assert_eq!(
r,
format!(
"0b00001100_00011111_01010010_00100000_01111011_00100000_01011100_00010111_00001100_00100000_00001100_00000001_00000001_00000001"
"0b00001100_00011111_01010010_\
00100000_01111011_00100000_01011100_00010111_00001100\n\
_00100000_00001100_00000001_00000001_00000001"
)
);
}

View file

@ -14,6 +14,5 @@ categories.workspace = true
[dependencies]
anyhow = "1.0.79"
cucumber = "0.20.2"
libpt-log = { workspace = true }
[dev-dependencies]