SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
test_utilities.hpp
1
2// Created by greg on 9/3/24.
3// Based on https://github.com/Algomorph/NeuralTracking/blob/main/cpp/tests/test_utils/test_utils.hpp,
4// Which was created by Gregory Kramida (https://github.com/Algomorph) on 2/28/21, Copyright (c) 2021 Gregory Kramida
5// Copyright (C) 2024 Presage Security, Inc.
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU Lesser General Public
9// License as published by the Free Software Foundation; either
10// version 3 of the License, or (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15// Lesser General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with this program; if not, write to the Free Software Foundation,
19// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22#pragma once
23// === standard library includes (if any) ===
24#include <filesystem>
25#include <memory>
26#include <string>
27#include <vector>
28// === third-party includes (if any) ===
29// === local includes (if any) ===
30#pragma once
31
32#include "compile_time_string_concatenation.hpp"
33#include <test_data_paths.hpp>
34
35
36
37namespace presage::smartspectra::test {
38static constexpr auto generated_test_data_directory = StringFactory(GENERATED_TEST_DATA_DIRECTORY);
39static constexpr auto generated_video_test_data_directory = StringFactory(GENERATED_TEST_DATA_DIRECTORY "videos");
40static constexpr auto generated_image_test_data_directory = StringFactory(GENERATED_TEST_DATA_DIRECTORY "images");
41static constexpr auto generated_json_test_data_directory = StringFactory(GENERATED_TEST_DATA_DIRECTORY "json");
42static constexpr auto static_test_data_directory = StringFactory(STATIC_TEST_DATA_DIRECTORY);
43static constexpr auto static_video_test_data_directory = StringFactory(STATIC_TEST_DATA_DIRECTORY "videos");
44static constexpr auto static_image_test_data_directory = StringFactory(STATIC_TEST_DATA_DIRECTORY "images");
45static constexpr auto static_array_test_data_directory = StringFactory(STATIC_TEST_DATA_DIRECTORY "arrays");
46static constexpr auto static_json_test_data_directory = StringFactory(STATIC_TEST_DATA_DIRECTORY "json");
47
48// index conversion for multidimensional arrays
49std::vector<long> UnravelIndex(long linear_index, const std::vector<long>& dimensions);
50
51template<typename TElement>
52struct ArrayElementMismatchInformation{
53 std::vector<long> position;
54 long linear_index;
55 TElement element1;
56 TElement element2;
57 float absolute_tolerance;
58 float relative_tolerance;
59};
60
61struct ArrayDimensionMismatchInformation{
62 std::vector<long> dimensions1;
63 std::vector<long> dimensions2;
64};
65
66template<typename TElement>
67struct ArrayComparisonResult{
68 bool arrays_match;
69 std::shared_ptr<ArrayDimensionMismatchInformation> dimension_mismatch_information;
70 std::shared_ptr<ArrayElementMismatchInformation<TElement>> element_mismatch_information;
71};
72
73} // namespace presage::smartspectra::test