Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Add VOC algorithm test for value after blackout period
Browse files Browse the repository at this point in the history
Immediatly after the warmup / blackout, the value should be the typical
/ offset value.
  • Loading branch information
rnestler committed Oct 26, 2020
1 parent 1dd6701 commit 10dee7c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/sensirion-voc-algorithm-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ TEST (Sgp40VocIndexAlgorithmTest, returns_zero_during_blackout) {
}
}

TEST (Sgp40VocIndexAlgorithmTest, returns_average_after_blackout) {
VocAlgorithmParams params;
VocAlgorithm_init(&params);
int32_t voc_index;
for (int i = 0; i < VocAlgorithm_INITIAL_BLACKOUT + 2; ++i) {
VocAlgorithm_process(&params, 0, &voc_index);
}

CHECK_EQUAL_TEXT(
VocAlgorithm_VOC_INDEX_OFFSET_DEFAULT, voc_index,
"VOC index should be the offset default after the the blackout period");
}

int main(int argc, char** argv) {
return CommandLineTestRunner::RunAllTests(argc, argv);
}

0 comments on commit 10dee7c

Please sign in to comment.