mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpiutil] DataLog: Ensure file is written on shutdown (#6087)
Previously the thread could end without the file being written.
This commit is contained in:
18
wpiutil/src/test/native/cpp/DataLogTest.cpp
Normal file
18
wpiutil/src/test/native/cpp/DataLogTest.cpp
Normal file
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user