forked from wpilibsuite/allwpilib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wpiutil] DataLog: Ensure file is written on shutdown (wpilibsuite#6087)
Previously the thread could end without the file being written.
- Loading branch information
1 parent
c29e8c6
commit 21d1972
Showing
3 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "wpi/DataLog.h" | ||
|
||
TEST(DataLogTest, SimpleInt) { | ||
std::vector<uint8_t> data; | ||
{ | ||
wpi::log::DataLog log{ | ||
[&](auto out) { data.insert(data.end(), out.begin(), out.end()); }}; | ||
int entry = log.Start("test", "int64"); | ||
log.AppendInteger(entry, 1, 0); | ||
} | ||
ASSERT_EQ(data.size(), 66u); | ||
} |