read bin file
This commit is contained in:
25
tests/helper/test_CsvBinary.cpp
Normal file
25
tests/helper/test_CsvBinary.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by stani on 3/14/25.
|
||||
//
|
||||
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include <numeric>
|
||||
#include <doctest/doctest.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "../../src/Config.h"
|
||||
#include "../../src/helper/CsvBinary.h"
|
||||
|
||||
TEST_CASE("Test Csv to binary and back") {
|
||||
CsvBinary::csvToBinary("Verbrauchsprofile.csv","Verbrauchsprofil.bin");
|
||||
CsvBinary::binaryToCsv("Verbrauchsprofil.bin","Restored.csv");
|
||||
auto verbrauchsProfil = CsvBinary::binaryToVector("Verbrauchsprofil.bin");
|
||||
for (auto &row: *verbrauchsProfil) {
|
||||
LOG_DEBUG_INFO("Sum from {}: {}",row.first ,std::accumulate(
|
||||
row.second.begin(), row.second.end(), 0.f,
|
||||
[](float sum, const std::string& val) {
|
||||
return sum + std::stof(val); // Convert string to float before addition
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
//
|
||||
// Created by StanislausCichocki on 10.03.2025.
|
||||
//
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "../../src/services/Surplus.h"
|
||||
|
||||
Reference in New Issue
Block a user