1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#include "gpu/testing.hpp"
#include <input/proceduralParser.hpp>
namespace VideoStitch {
namespace Testing {
void testNotProcedural() {
Input::ProceduralInputSpec spec("nothing");
ENSURE(!spec.isProcedural());
}
void testProceduralOneOption() {
Input::ProceduralInputSpec spec("procedural:toto(titi=3)");
ENSURE(spec.isProcedural());
ENSURE_EQ(std::string("toto"), spec.getName());
ENSURE(spec.getOption("titi"));
ENSURE_EQ(std::string("3"), *spec.getOption("titi"));
}
void testProcedural() {
Input::ProceduralInputSpec spec("procedural:toto(titi=3,tata=3.14,tutu=truc)");
ENSURE(spec.isProcedural());
ENSURE_EQ(std::string("toto"), spec.getName());
ENSURE(spec.getOption("titi"));
ENSURE_EQ(std::string("3"), *spec.getOption("titi"));
ENSURE(spec.getOption("tata"));
ENSURE_EQ(std::string("3.14"), *spec.getOption("tata"));
ENSURE(spec.getOption("tutu"));
ENSURE_EQ(std::string("truc"), *spec.getOption("tutu"));
}
void testProceduralNoOptions() {
Input::ProceduralInputSpec spec("procedural:toto");
ENSURE(spec.isProcedural());
ENSURE_EQ(std::string("toto"), spec.getName());
}
} // namespace Testing
} // namespace VideoStitch
int main() {
VideoStitch::Testing::initTest();
VideoStitch::Testing::testNotProcedural();
VideoStitch::Testing::testProceduralOneOption();
VideoStitch::Testing::testProcedural();
VideoStitch::Testing::testProceduralNoOptions();
return 0;
}