Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
parser.t.cc File Reference
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
#include "parser.h"

Go to the source code of this file.

Functions

 TEST_CASE ("samples string separated by single spaces should not fail", "[parseWaveformSamples]")
 
 TEST_CASE ("samples string separated by multiple spaces should not fail", "[parseWaveformSamples]")
 
 TEST_CASE ("if the waveform id is not an integer return std::nullopt", "[parseWaveformSamples]")
 
 TEST_CASE ("if the number of samples is not an integer return std::nullopt", "[parseWaveformSamples]")
 

Variables

const Waveform< float > expected
 

Function Documentation

◆ TEST_CASE() [1/4]

TEST_CASE ( "samples string separated by single spaces should not fail" ,
"" [parseWaveformSamples] )

Definition at line 8 of file parser.t.cc.

9{
10 auto result = parseWaveformSamples<float>("14 3 1.1 2.2 3.3");
11
12 REQUIRE(result.value() == expected);
13}
std::optional< Waveform< T > > parseWaveformSamples(const std::string &adf_waveform_line)
Definition parser.cc:46
const Waveform< float > expected
Definition parser.t.cc:5

◆ TEST_CASE() [2/4]

TEST_CASE ( "samples string separated by multiple spaces should not fail" ,
"" [parseWaveformSamples] )

Definition at line 15 of file parser.t.cc.

16{
17 auto result = parseWaveformSamples<float>("14 3 1.1 2.2 3.3");
18
19 REQUIRE(result.value() == expected);
20}

◆ TEST_CASE() [3/4]

TEST_CASE ( "if the waveform id is not an integer return std::nullopt" ,
"" [parseWaveformSamples] )

Definition at line 22 of file parser.t.cc.

23{
24 auto result = parseWaveformSamples<float>("1.1 2.2 3.3");
25
26 REQUIRE(result == std::nullopt);
27}

◆ TEST_CASE() [4/4]

TEST_CASE ( "if the number of samples is not an integer return std::nullopt" ,
"" [parseWaveformSamples] )

Definition at line 29 of file parser.t.cc.

30{
31 auto result = parseWaveformSamples<float>("3 1.1 2.2 3.3");
32
33 REQUIRE(result == std::nullopt);
34}

Variable Documentation

◆ expected

const Waveform<float> expected
Initial value:
{
14, {1.1F, 2.2F, 3.3F}}

Definition at line 5 of file parser.t.cc.

5 {
614, {1.1F, 2.2F, 3.3F}};