Cambridge SMT System
address.gtest.cpp
Go to the documentation of this file.
1
// Licensed under the Apache License, Version 2.0 (the "License");
2
// you may not use these files except in compliance with the License.
3
// You may obtain a copy of the License at
4
//
5
// http://www.apache.org/licenses/LICENSE-2.0
6
//
7
// Unless required by applicable law or agreed to in writing, software
8
// distributed under the License is distributed on an "AS IS" BASIS,
9
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
// See the License for the specific language governing permissions and
11
// limitations under the License.
12
13
// Copyright 2012 - Gonzalo Iglesias, AdriĆ de Gispert, William Byrne
14
21
#include <
googletesting.h
>
22
#ifndef GMAINTEST
23
#include "
main.custom_assert.hpp
"
24
#include "
main.logger.hpp
"
25
#endif
26
27
#include "
registrypo.hpp
"
28
#include "
addresshandler.hpp
"
29
34
TEST
( patternaddress, test1 ) {
35
ucam::util::IntegerPatternAddress
ipa (
"lm/?.lm.gz"
,
"?"
);
36
std::string aux = ipa.
get
( 3 );
37
EXPECT_EQ ( aux,
"lm/3.lm.gz"
);
38
aux = ipa ( 3 );
39
EXPECT_EQ ( aux,
"lm/3.lm.gz"
);
40
aux = ipa();
41
EXPECT_EQ ( aux,
"lm/?.lm.gz"
);
42
}
43
47
TEST
( patternaddress, test2 ) {
48
ucam::util::IntegerPatternAddress
ipa (
"expecto.fst"
,
"?"
);
49
std::string aux = ipa.
get
( 3 );
50
EXPECT_EQ ( aux,
"expecto.fst"
);
51
aux = ipa ( 3 );
52
EXPECT_EQ ( aux,
"expecto.fst"
);
53
aux = ipa();
54
EXPECT_EQ ( aux,
"expecto.fst"
);
55
}
56
61
TEST
( patternaddress, test3 ) {
62
ucam::util::IntegerPatternAddress
ipa (
""
,
"?"
);
63
std::string aux = ipa.
get
( 3 );
64
EXPECT_EQ ( aux,
""
);
65
aux = ipa ( 3 );
66
EXPECT_EQ ( aux,
""
);
67
aux = ipa();
68
EXPECT_EQ ( aux,
""
);
69
}
70
71
#ifndef GMAINTEST
72
78
int
main
(
int
argc,
char
**argv ) {
79
::testing::InitGoogleTest ( &argc, argv );
80
return
RUN_ALL_TESTS();
81
}
82
#endif
addresshandler.hpp
Handles simple wildcard expansion for strings.
ucam::util::PatternAddress
class that expands a wildcard into its actual value. This is useful e.g. for filenames ranging severa...
Definition:
addresshandler.hpp:33
main
int main(int argc, char **argv)
main function. If compiled individualy, will kickoff any tests in this file.
Definition:
address.gtest.cpp:78
main.logger.hpp
Static variables for logger. Include only once from main file.
registrypo.hpp
Contains wrapper class RegistryPO, which uses boost::program_options to parse parameters, and provides methods to access them.
TEST
TEST(patternaddress, test1)
Tests wildcard expansion with an integer.
Definition:
address.gtest.cpp:34
ucam::util::PatternAddress::get
const std::string get(T idx)
Expands string and returns.
Definition:
addresshandler.hpp:59
googletesting.h
Unit testing: google testing common header.
main.custom_assert.hpp
Static variable for custom_assert. Include only once from main file.
ucam-smt
cpp
tests
address.gtest.cpp
Generated on Wed May 25 2016 10:26:00 for Cambridge SMT System by
1.8.11