Compare commits

..

4 commits

Author SHA1 Message Date
d58207cb5d
remove cucumber dependency from core
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m0s
2024-03-03 17:19:29 +01:00
97b8086624
fix bintolsdisplay
All checks were successful
cargo devel CI / cargo CI (push) Successful in 1m27s
2024-03-03 17:16:50 +01:00
5a7f980c92
ci install python
Some checks failed
cargo devel CI / cargo CI (push) Failing after 1m37s
2024-03-03 16:51:26 +01:00
c4921ec364
update cargo ci
Some checks failed
cargo devel CI / cargo CI (push) Failing after 2m7s
2024-03-03 14:02:19 +01:00
5 changed files with 23 additions and 15 deletions

View file

@ -31,13 +31,15 @@ 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
run: cargo clippy --all-features --all-targets --workspace
- name: cargo clippy fix
run: cargo clippy --fix --all-features --all-targets
run: cargo clippy --fix --all-features --all-targets --workspace
- 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
run: cargo test --all-features --all-targets --workspace
- name: commit back to repository
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
with:

View file

@ -32,13 +32,15 @@ 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
run: cargo clippy --all-features --all-targets --workspace
- name: cargo clippy fix
run: cargo clippy --fix --all-features --all-targets
run: cargo clippy --fix --all-features --all-targets --workspace
- 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
run: cargo test --all-features --all-targets --workspace
- name: commit back to repository
uses: stefanzweifel/git-auto-commit-action@v5
with:

View file

@ -8,11 +8,12 @@ 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 = format!("0b{:08b}", data.first().unwrap());
for dat in data {
let mut s = String::new();
for (i, dat) in data.iter().enumerate() {
if i == 0 {
s.push_str(&format!("0b{:08b}", dat));
} else {
s.push_str(&format!("_{:08b}", dat));
if dat % 8 == 0 {
s.push('\n')
}
}
s

View file

@ -6,6 +6,10 @@ 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]
@ -15,9 +19,7 @@ fn big_btobin() {
assert_eq!(
r,
format!(
"0b00001100_00011111_01010010_\
00100000_01111011_00100000_01011100_00010111_00001100\n\
_00100000_00001100_00000001_00000001_00000001"
"0b00001100_00011111_01010010_00100000_01111011_00100000_01011100_00010111_00001100_00100000_00001100_00000001_00000001_00000001"
)
);
}

View file

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