Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
iter: document tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmplt committed Nov 27, 2021
1 parent 12f482a commit 3931431
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions itm/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ mod timestamps {
const FREQ: u32 = 16_000_000;
static mut BASELINE: Option<chrono::DateTime<chrono::Utc>> = None;

/// Auxilliary function that re-implements the timestamp calculation
/// logic of [Timestamps::next_timestamped].
fn outer_calc_offset(
lts: TracePacket,
gts: Option<Gts>,
Expand Down Expand Up @@ -478,6 +480,8 @@ mod timestamps {
true
}

/// Check whether timestamps are correctly generated by effectively
/// comparing `Timestamps::next_timestamps` and [outer_calc_offset].
#[test]
fn check_timestamps() {
unsafe {
Expand Down Expand Up @@ -653,6 +657,8 @@ mod timestamps {
}
}

/// Test cases where a GTS2 applied to two GTS1; 64-bit GTS2; and
/// compares timestamps to precalculated [chrono::Duration] offsets.
#[test]
fn gts_compression() {
unsafe {
Expand Down Expand Up @@ -693,6 +699,9 @@ mod timestamps {

// LTS2
0b0110_0000,

// TODO: add a section where a GTS1 must merge with the
// previous GTS1
];

let timestamps = {
Expand Down

0 comments on commit 3931431

Please sign in to comment.