KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_kiid.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 (C) 1992-2021 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 along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <boost/test/unit_test.hpp>
21#include <kiid.h>
22
23
25
26
28{
30
31 KIID a0;
32 KIID b0;
33 KIID c0;
34 KIID d0;
35
37
38 KIID a;
39 BOOST_CHECK_EQUAL( a.Hash(), a0.Hash() );
40
41 KIID b;
42 BOOST_CHECK_EQUAL( b.Hash(), b0.Hash() );
43
44 KIID c;
45 BOOST_CHECK_EQUAL( c.Hash(), c0.Hash() );
46
47 KIID d;
48 BOOST_CHECK_EQUAL( d.Hash(), d0.Hash() );
49}
50
51
52BOOST_AUTO_TEST_CASE( KiidPathTest )
53{
54 KIID a, b, c, d;
55
56 KIID_PATH path1;
57 KIID_PATH path2;
58
59 path1.push_back( a );
60 path1.push_back( b );
61 path1.push_back( c );
62 path1.push_back( d );
63
64 path2.push_back( b );
65 path2.push_back( c );
66 path2.push_back( d );
67
68 BOOST_CHECK( path1.EndsWith( path2 ) == true );
69 BOOST_CHECK( path2.EndsWith( path1 ) == false );
70}
71
72
73BOOST_AUTO_TEST_SUITE_END()
bool EndsWith(const KIID_PATH &aPath) const
Test if aPath from the last path towards the first path.
Definition: kiid.cpp:347
Definition: kiid.h:49
static void SeedGenerator(unsigned int aSeed)
Re-initialize the UUID generator with a given seed (for testing or QA purposes)
Definition: kiid.cpp:306
size_t Hash() const
Definition: kiid.cpp:236
BOOST_CHECK(box.ClosestPointTo(VECTOR2D(0, 0))==VECTOR2D(1, 2))
Test suite for KiCad math code.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(Seeding)
Definition: test_kiid.cpp:27