generated from PlexSheep/baserepo
Compare commits
No commits in common. "d58207cb5dc29a0a2188686877b014bc6f66a508" and "222d248fabdce689b7f16ce4358977bb4bb1c355" have entirely different histories.
d58207cb5d
...
222d248fab
5 changed files with 15 additions and 23 deletions
|
@ -31,15 +31,13 @@ jobs:
|
||||||
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
|
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
|
||||||
cat ~/.cargo/config.toml
|
cat ~/.cargo/config.toml
|
||||||
- name: cargo clippy check
|
- name: cargo clippy check
|
||||||
run: cargo clippy --all-features --all-targets --workspace
|
run: cargo clippy --all-features --all-targets
|
||||||
- name: cargo clippy fix
|
- name: cargo clippy fix
|
||||||
run: cargo clippy --fix --all-features --all-targets --workspace
|
run: cargo clippy --fix --all-features --all-targets
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo fmt --all
|
run: cargo fmt --all
|
||||||
- name: install python
|
|
||||||
run: apt update && apt install libpython3-dev -y
|
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
run: cargo test --all-features --all-targets --workspace
|
run: cargo test --all-features --all-targets
|
||||||
- name: commit back to repository
|
- name: commit back to repository
|
||||||
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
8
.github/workflows/cargo.yaml
vendored
8
.github/workflows/cargo.yaml
vendored
|
@ -32,15 +32,13 @@ jobs:
|
||||||
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
|
echo 'index = "https://git.cscherr.de/PlexSheep/_cargo-index.git"' >> ~/.cargo/config.toml
|
||||||
cat ~/.cargo/config.toml
|
cat ~/.cargo/config.toml
|
||||||
- name: cargo clippy check
|
- name: cargo clippy check
|
||||||
run: cargo clippy --all-features --all-targets --workspace
|
run: cargo clippy --all-features --all-targets
|
||||||
- name: cargo clippy fix
|
- name: cargo clippy fix
|
||||||
run: cargo clippy --fix --all-features --all-targets --workspace
|
run: cargo clippy --fix --all-features --all-targets
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo fmt --all
|
run: cargo fmt --all
|
||||||
- name: install python
|
|
||||||
run: apt update && apt install libpython3-dev -y
|
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
run: cargo test --all-features --all-targets --workspace
|
run: cargo test --all-features --all-targets
|
||||||
- name: commit back to repository
|
- name: commit back to repository
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -8,12 +8,11 @@ pub use num_traits::{PrimInt, ToPrimitive};
|
||||||
/// ### Arguments
|
/// ### Arguments
|
||||||
/// * `data` - The data you are trying to dump
|
/// * `data` - The data you are trying to dump
|
||||||
pub fn bytes_to_bin(data: &[u8]) -> String {
|
pub fn bytes_to_bin(data: &[u8]) -> String {
|
||||||
let mut s = String::new();
|
let mut s = format!("0b{:08b}", data.first().unwrap());
|
||||||
for (i, dat) in data.iter().enumerate() {
|
for dat in data {
|
||||||
if i == 0 {
|
s.push_str(&format!("_{:08b}", dat));
|
||||||
s.push_str(&format!("0b{:08b}", dat));
|
if dat % 8 == 0 {
|
||||||
} else {
|
s.push('\n')
|
||||||
s.push_str(&format!("_{:08b}", dat));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s
|
s
|
||||||
|
|
|
@ -6,10 +6,6 @@ fn btobin() {
|
||||||
let data = [19, 19];
|
let data = [19, 19];
|
||||||
let r = bytes_to_bin(&data);
|
let r = bytes_to_bin(&data);
|
||||||
assert_eq!(r, format!("0b00010011_00010011"));
|
assert_eq!(r, format!("0b00010011_00010011"));
|
||||||
|
|
||||||
let data = [0xff, 0xff];
|
|
||||||
let r = bytes_to_bin(&data);
|
|
||||||
assert_eq!(r, format!("0b11111111_11111111"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -19,7 +15,9 @@ fn big_btobin() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r,
|
r,
|
||||||
format!(
|
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"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,5 @@ categories.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.79"
|
anyhow = "1.0.79"
|
||||||
|
cucumber = "0.20.2"
|
||||||
libpt-log = { workspace = true }
|
libpt-log = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
|
|
Reference in a new issue