KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_string_any_map.cpp
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
*/
19
20
#define BOOST_TEST_NO_MAIN
21
#include <
qa_utils/wx_utils/unit_test_utils.h
>
22
23
#include <
base_units.h
>
24
#include <
string_any_map.h
>
25
26
27
BOOST_AUTO_TEST_SUITE
( StringAnyMap )
28
29
30
// 1.001 mm scales to 1000999.9999999999 nm, which a generator must not load 1 nm short
31
BOOST_AUTO_TEST_CASE
( GetToIuRoundsIntegralValues )
32
{
33
STRING_ANY_MAP
props(
pcbIUScale
.IU_PER_MM );
34
props.
set_iu
(
"width"
, 1001000 );
35
props.
set
(
"offset"
, -1.001 );
36
props.
set
(
"length"
, 1.001 );
37
38
int
value = 0;
39
long
long
length = 0;
40
41
BOOST_REQUIRE
( props.
get_to_iu
(
"width"
, value ) );
42
BOOST_CHECK_EQUAL
( value, 1001000 );
43
44
BOOST_REQUIRE
( props.
get_to_iu
(
"offset"
, value ) );
45
BOOST_REQUIRE
( props.
get_to_iu
(
"length"
, length ) );
46
BOOST_CHECK_EQUAL
( value, -1001000 );
47
BOOST_CHECK_EQUAL
( length, 1001000 );
48
}
49
50
51
BOOST_AUTO_TEST_SUITE_END
()
base_units.h
pcbIUScale
constexpr EDA_IU_SCALE pcbIUScale
Definition
base_units.h:128
STRING_ANY_MAP
A name/value tuple with unique names and wxAny values.
Definition
string_any_map.h:38
STRING_ANY_MAP::set_iu
void set_iu(const std::string &aKey, const T &aVar)
Definition
string_any_map.h:94
STRING_ANY_MAP::set
void set(const std::string &aKey, const T &aVar)
Definition
string_any_map.h:88
STRING_ANY_MAP::get_to_iu
bool get_to_iu(const std::string &aKey, T &aVar) const
Definition
string_any_map.h:55
string_any_map.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
Definition
test_api_enums.cpp:80
BOOST_AUTO_TEST_SUITE
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(result, "25.4")
unit_test_utils.h
src
qa
tests
common
test_string_any_map.cpp
Generated on Wed Oct 7 2026 00:06:07 for KiCad PCB EDA Suite by
1.13.2