Fixed unit tests and MSVC build

This commit is contained in:
Matthias Koefferlein 2023-08-05 21:02:26 +02:00
parent 76a1450f32
commit d958d71e2e
5 changed files with 27 additions and 27 deletions

View File

@ -579,8 +579,8 @@ Path round_path_corners (const Path &path, int rad, int n)
return Path (round_path_corners (db::DPath (path), double (rad), n, 0.5)); return Path (round_path_corners (db::DPath (path), double (rad), n, 0.5));
} }
template class path<Coord>; template class DB_PUBLIC path<Coord>;
template class path<DCoord>; template class DB_PUBLIC path<DCoord>;
// explicit instantiations // explicit instantiations
template DB_PUBLIC void path<Coord>::create_shifted_points (Coord, Coord, Coord, bool, path<Coord>::pointlist_type::iterator, path<Coord>::pointlist_type::iterator, int, box_inserter<path<Coord>::box_type>) const; template DB_PUBLIC void path<Coord>::create_shifted_points (Coord, Coord, Coord, bool, path<Coord>::pointlist_type::iterator, path<Coord>::pointlist_type::iterator, int, box_inserter<path<Coord>::box_type>) const;

View File

@ -121,22 +121,22 @@ std::string text<C>::to_string (double dbu) const
return s; return s;
} }
template class text<Coord>; template class DB_PUBLIC text<Coord>;
template class text<DCoord>; template class DB_PUBLIC text<DCoord>;
} }
namespace tl namespace tl
{ {
template<> void extractor_impl (tl::Extractor &ex, db::Text &p) template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Text &p)
{ {
if (! test_extractor_impl (ex, p)) { if (! test_extractor_impl (ex, p)) {
ex.error (tl::to_string (tr ("Expected a text specification"))); ex.error (tl::to_string (tr ("Expected a text specification")));
} }
} }
template<> void extractor_impl (tl::Extractor &ex, db::DText &p) template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DText &p)
{ {
if (! test_extractor_impl (ex, p)) { if (! test_extractor_impl (ex, p)) {
ex.error (tl::to_string (tr ("Expected a text specification"))); ex.error (tl::to_string (tr ("Expected a text specification")));
@ -189,12 +189,12 @@ template<class C> bool _test_extractor_impl (tl::Extractor &ex, db::text<C> &t)
} }
} }
template<> bool test_extractor_impl (tl::Extractor &ex, db::Text &p) template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::Text &p)
{ {
return _test_extractor_impl (ex, p); return _test_extractor_impl (ex, p);
} }
template<> bool test_extractor_impl (tl::Extractor &ex, db::DText &p) template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::DText &p)
{ {
return _test_extractor_impl (ex, p); return _test_extractor_impl (ex, p);
} }

View File

@ -1167,7 +1167,7 @@ TEST(5)
EXPECT_EQ (r.text (), EXPECT_EQ (r.text (),
"layout_diff: texts differ for layer 17/0 in cell c2x\n" "layout_diff: texts differ for layer 17/0 in cell c2x\n"
"Not in b but in a:\n" "Not in b but in a:\n"
" ('X',r90 2,3)\n" " ('X',r90 2,3) s=17\n"
"Not in a but in b:\n" "Not in a but in b:\n"
); );
@ -1198,10 +1198,10 @@ TEST(5)
"layout_diff: texts differ for layer 17/0 in cell c2x\n" "layout_diff: texts differ for layer 17/0 in cell c2x\n"
"Not in b but in a:\n" "Not in b but in a:\n"
"Not in a but in b:\n" "Not in a but in b:\n"
" ('X',r90 2,3)\n" " ('X',r90 2,3) s=18\n"
" ('Y',r90 2,3)\n" " ('Y',r90 2,3) s=17\n"
" ('X',r90 3,4)\n" " ('X',r90 3,4) s=17\n"
" ('X',r180 2,3)\n" " ('X',r180 2,3) s=17\n"
); );
// two more to match more of h: // two more to match more of h:
@ -1216,8 +1216,8 @@ TEST(5)
"layout_diff: texts differ for layer 17/0 in cell c2x\n" "layout_diff: texts differ for layer 17/0 in cell c2x\n"
"Not in b but in a:\n" "Not in b but in a:\n"
"Not in a but in b:\n" "Not in a but in b:\n"
" ('Y',r90 2,3)\n" " ('Y',r90 2,3) s=17\n"
" ('X',r180 2,3)\n" " ('X',r180 2,3) s=17\n"
); );
} }

View File

@ -1102,7 +1102,7 @@ class DBShapes_TestClass < TestBase
arr = [] arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) } shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) prop_id=1"] ) assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b prop_id=1"] )
assert_equal( s1.is_valid?, true ) assert_equal( s1.is_valid?, true )
assert_equal( s1.shapes.is_valid?(s1), true ) assert_equal( s1.shapes.is_valid?(s1), true )
@ -1316,7 +1316,7 @@ class DBShapes_TestClass < TestBase
arr = [] arr = []
shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) } shapes.each( RBA::Shapes::SAll ) { |s| arr.push( s.to_s ) }
assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) prop_id=1"] ) assert_equal( arr, ["edge (1,2;3,4)", "text ('text',r0 100,200)", "text ('blabla',m0 100,200) f=3 ha=c va=b prop_id=1"] )
assert_equal( s1.is_valid?, true ) assert_equal( s1.is_valid?, true )
assert_equal( s1.shapes.is_valid?(s1), true ) assert_equal( s1.shapes.is_valid?(s1), true )

View File

@ -102,20 +102,20 @@ class DBText_TestClass < TestBase
b = a.dup b = a.dup
assert_equal( a.moved( RBA::DPoint::new( 0, 1 ) ).to_s, "('hallo',m45 5,8)" ) assert_equal( a.moved( RBA::DPoint::new( 0, 1 ) ).to_s, "('hallo',m45 5,8) s=23 f=8 ha=r va=b" )
a.move( RBA::DPoint::new( 1, 0 ) ) a.move( RBA::DPoint::new( 1, 0 ) )
assert_equal( a.to_s, "('hallo',m45 6,7)" ) assert_equal( a.to_s, "('hallo',m45 6,7) s=23 f=8 ha=r va=b" )
b = b.transformed( RBA::DTrans::new( RBA::DTrans::R0, RBA::DPoint::new( 1, 0 )) ) b = b.transformed( RBA::DTrans::new( RBA::DTrans::R0, RBA::DPoint::new( 1, 0 )) )
assert_equal( b.to_s, "('hallo',m45 6,7)" ) assert_equal( b.to_s, "('hallo',m45 6,7) s=23 f=8 ha=r va=b" )
m = RBA::DCplxTrans::new( RBA::DTrans::new, 1.5 ) m = RBA::DCplxTrans::new( RBA::DTrans::new, 1.5 )
assert_equal( a.transformed(m).class.to_s, "RBA::DText" ) assert_equal( a.transformed(m).class.to_s, "RBA::DText" )
assert_equal( a.transformed(m).to_s, "('hallo',m45 9,10.5)" ) assert_equal( a.transformed(m).to_s, "('hallo',m45 9,10.5) s=34.5 f=8 ha=r va=b" )
m = RBA::VCplxTrans::new( 1000.0 ) m = RBA::VCplxTrans::new( 1000.0 )
assert_equal( a.transformed(m).class.to_s, "RBA::Text" ) assert_equal( a.transformed(m).class.to_s, "RBA::Text" )
assert_equal( a.transformed(m).to_s, "('hallo',m45 6000,7000)" ) assert_equal( a.transformed(m).to_s, "('hallo',m45 6000,7000) s=23000 f=8 ha=r va=b" )
end end
@ -196,16 +196,16 @@ class DBText_TestClass < TestBase
b = a.dup b = a.dup
assert_equal( a.moved( RBA::Point::new( 0, 1 ) ).to_s, "('hallo',m45 5,8)" ) assert_equal( a.moved( RBA::Point::new( 0, 1 ) ).to_s, "('hallo',m45 5,8) s=23 f=8 ha=l va=t" )
a.move( RBA::Point::new( 1, 0 ) ) a.move( RBA::Point::new( 1, 0 ) )
assert_equal( a.to_s, "('hallo',m45 6,7)" ) assert_equal( a.to_s, "('hallo',m45 6,7) s=23 f=8 ha=l va=t" )
b = b.transformed( RBA::Trans::new( RBA::Trans::R0, RBA::Point::new( 1, 0 )) ) b = b.transformed( RBA::Trans::new( RBA::Trans::R0, RBA::Point::new( 1, 0 )) )
assert_equal( b.to_s, "('hallo',m45 6,7)" ) assert_equal( b.to_s, "('hallo',m45 6,7) s=23 f=8 ha=l va=t" )
m = RBA::CplxTrans::new( RBA::Trans::new, 1.5 ) m = RBA::CplxTrans::new( RBA::Trans::new, 1.5 )
assert_equal( a.transformed(m).to_s, "('hallo',m45 9,10.5)" ) assert_equal( a.transformed(m).to_s, "('hallo',m45 9,10.5) s=34.5 f=8 ha=l va=t" )
assert_equal( a.transformed(RBA::ICplxTrans::new(m)).to_s, "('hallo',m45 9,11)" ) assert_equal( a.transformed(RBA::ICplxTrans::new(m)).to_s, "('hallo',m45 9,11) s=35 f=8 ha=l va=t" )
end end