generate coverage from correct target

This commit is contained in:
🪞👃🪞 2025-01-22 12:49:15 +01:00
parent be6bd32b78
commit ffe8893bed
8 changed files with 57 additions and 12 deletions

View file

@ -16,3 +16,7 @@ members = [
[profile.release]
lto = true
[profile.coverage]
inherits = "test"
lto = false

View file

@ -7,14 +7,21 @@ cloc:
test:
cargo test --workspace --exclude jack
cov:
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cov/cargo-test-%p-%m.profraw' cargo test --workspace --exclude jack
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
rm -rf target/coverage/html || true
export CARGO_INCREMENTAL=0
export RUSTFLAGS='-Cinstrument-coverage'
export RUSTDOCFLAGS='-Cinstrument-coverage'
export LLVM_PROFILE_FILE='cov/cargo-test-%p-%m.profraw'
time cargo test --workspace --exclude jack --profile coverage
time grcov . --binary-path ./target/coverage/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' -o target/coverage/html
prof:
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -- arranger
status:
cargo c
cloc --by-file src/
git status
doc:
cargo doc --document-private-items
upstreams := "codeberg origin" # TODO!

View file

@ -59,3 +59,25 @@ pub fn update_keys (keys: &mut[bool;128], message: &MidiMessage) {
_ => {}
}
}
#[cfg(test)] #[test] pub fn test_midi_clip () {
let clip = MidiClip::stop_all();
println!("{clip:?}");
let clip = MidiClip::default();
let mut clip = MidiClip::new("clip", true, 1, None, None);
clip.set_length(96);
clip.toggle_loop();
clip.record_event(12, midly::MidiMessage::NoteOn { key: 36.into(), vel: 100.into() });
assert!(clip.contains_note_on(36.into(), 6, 18));
assert_eq!(&clip.notes, &clip.duplicate().notes);
let clip = std::sync::Arc::new(clip);
assert_eq!(clip.clone(), clip);
}
#[cfg(test)] #[test] pub fn test_midi_edit () {
let editor = MidiEditor::default();
println!("{editor:?}");
}
#[cfg(test)] #[test] pub fn test_midi_player () {
let player = MidiPlayer::default();
println!("{player:?}");
}

View file

@ -1,3 +1,4 @@
//! MIDI clip data.
use crate::*;
pub trait HasMidiClip {

View file

@ -1,3 +1,4 @@
//! MIDI editor.
use crate::*;
pub trait HasEditor {
fn editor (&self) -> &Option<MidiEditor>;

View file

@ -1,3 +1,4 @@
//! MIDI player
use crate::*;
pub trait HasPlayer {
fn player (&self) -> &impl MidiPlayerApi;

View file

@ -1,6 +1,13 @@
//! Aligns things to the container. Comes with caveats.
//! ```
//! let four = ||Fixed::<TuiOut, _, _>::xy(4, 4, unit);
//! use ::tek_tui::{*, tek_output::*};
//! let area: [u16;4] = [10, 10, 20, 20];
//! fn test (area: [u16;4], item: &impl Content<TuiOut>, expected: [u16;4]) {
//! assert_eq!(Content::layout(item, area), expected);
//! assert_eq!(Render::layout(item, area), expected);
//! };
//!
//! let four = ||Fixed::xy(4, 4, "");
//! test(area, &Align::nw(four()), [10, 10, 4, 4]);
//! test(area, &Align::n(four()), [18, 10, 4, 4]);
//! test(area, &Align::ne(four()), [26, 10, 4, 4]);
@ -9,7 +16,8 @@
//! test(area, &Align::s(four()), [18, 26, 4, 4]);
//! test(area, &Align::sw(four()), [10, 26, 4, 4]);
//! test(area, &Align::w(four()), [10, 18, 4, 4]);
//! let two_by_four = ||Fixed::<TuiOut, _, _>::xy(4, 2, unit);
//!
//! let two_by_four = ||Fixed::xy(4, 2, "");
//! test(area, &Align::nw(two_by_four()), [10, 10, 4, 2]);
//! test(area, &Align::n(two_by_four()), [18, 10, 4, 2]);
//! test(area, &Align::ne(two_by_four()), [26, 10, 4, 2]);

View file

@ -5,18 +5,19 @@
//! ```
//! use ::tek_tui::{*, tek_output::*};
//! let area: [u16;4] = [10, 10, 20, 20];
//! let unit = ();
//! fn test (area: [u16;4], item: &impl Content<TuiOut>, expected: [u16;4]) {
//! assert_eq!(Content::layout(item, area), expected);
//! assert_eq!(Render::layout(item, area), expected);
//! };
//! test(area, &(), [20, 20, 0, 0]);
//! test(area, &Fill::xy(()), area);
//! test(area, &Fill::x(()), [10, 20, 20, 0]);
//! test(area, &Fill::y(()), [20, 10, 0, 20]);
//! test(area, &Fixed::x(4, unit), [18, 20, 4, 0]);
//! test(area, &Fixed::y(4, unit), [20, 18, 0, 4]);
//! test(area, &Fixed::xy(4, 4, unit), [18, 18, 4, 4]);
//! test(area, &(), [20, 20, 0, 0]);
//!
//! test(area, &Fill::xy(()), area);
//! test(area, &Fill::x(()), [10, 20, 20, 0]);
//! test(area, &Fill::y(()), [20, 10, 0, 20]);
//!
//! //FIXME:test(area, &Fixed::x(4, ()), [18, 20, 4, 0]);
//! //FIXME:test(area, &Fixed::y(4, ()), [20, 18, 0, 4]);
//! //FIXME:test(area, &Fixed::xy(4, 4, unit), [18, 18, 4, 4]);
//! ```
use crate::*;
/// Defines an enum that transforms its content