From f26fac58fd3163894c6494655e126e3f0a5b9afc Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 5 Jan 2024 23:19:55 +0100 Subject: [PATCH 1/2] Implementation of fix for issue #1586 - the "to_dtrans" now behaves as expected - the conversion constructors have been generalized by adding a 'dbu' argument - the conversion constructors now are favoured instead of the to_xxx functions - some of the to_xxx functions are ill-named and are deprecated --- src/db/db/gsiDeclDbTrans.cc | 284 ++++++++++++++++++++++++++---------- 1 file changed, 209 insertions(+), 75 deletions(-) diff --git a/src/db/db/gsiDeclDbTrans.cc b/src/db/db/gsiDeclDbTrans.cc index 40607b1ec6..411fa41df2 100644 --- a/src/db/db/gsiDeclDbTrans.cc +++ b/src/db/db/gsiDeclDbTrans.cc @@ -980,72 +980,114 @@ struct cplx_trans_defs } }; -template -static F *cplxtrans_from_cplxtrans (const I &t) +namespace { + +template struct dbu_trans; + +template<> +struct dbu_trans { - return new F (t); -} + db::ICplxTrans operator() (double /*dbu*/) const { return db::ICplxTrans (); } +}; -template -static F cplxtrans_to_cplxtrans (const I *t) +template<> +struct dbu_trans +{ + db::VCplxTrans operator() (double dbu) const { return db::VCplxTrans (1.0 / dbu); } +}; + +template<> +struct dbu_trans +{ + db::CplxTrans operator() (double dbu) const { return db::CplxTrans (dbu); } +}; + +template<> +struct dbu_trans { - return F (*t); + db::DCplxTrans operator() (double /*dbu*/) const { return db::DCplxTrans (); } +}; + } template -static F cplxtrans_to_icplxtrans (const I *t, double dbu) +static F *cplxtrans_from_cplxtrans (const I &t, double dbu) { - F f = F (*t); - f.disp (typename F::displacement_type (f.disp () * (1.0 / dbu))); - return f; + return new F (dbu_trans () (dbu) * t * dbu_trans () (dbu)); } template -static F cplxtrans_to_dcplxtrans (const I *t, double dbu) +static F cplxtrans_to_cplxtrans (const I *t, double dbu) { - F f = F (*t); - f.disp (f.disp () * dbu); - return f; + return F (dbu_trans () (dbu) * *t * dbu_trans () (dbu)); } Class decl_DCplxTrans ("db", "DCplxTrans", - constructor ("new|#from_itrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), + constructor ("new|#from_itrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the input space from integer units to floating-point units. " + "Formally, the DCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation " + "into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25 and replaces the previous static method 'from_itrans'." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. " + "Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * to_dbu' where 'to_dbu' is the transformation " + "into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. 'from_dbu' is the transformation into micrometer space, " + "or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the output space from integer units to floating-point units. " + "Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - method_ext ("to_itrans", &cplxtrans_to_icplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer input and output coordinates\n" "\n" "The database unit can be specified to translate the floating-point coordinate " "displacement in micron units to an integer-coordinate displacement in database units. The displacement's' " "coordinates will be divided by the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor:\n" + "\n" + "@code\n" + "itrans = RBA::ICplxTrans::new(dtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_vtrans", &cplxtrans_to_icplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer output coordinates\n" "\n" "The database unit can be specified to translate the floating-point coordinate " "displacement in micron units to an integer-coordinate displacement in database units. The displacement's' " "coordinates will be divided by the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor:\n" + "\n" + "@code\n" + "vtrans = RBA::VCplxTrans::new(dtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_trans", &cplxtrans_to_cplxtrans, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer input coordinates\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor:\n" + "\n" + "@code\n" + "trans = RBA::CplxTrans::new(dtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + method ("*!", (db::CplxTrans (db::DCplxTrans::*) (const db::CplxTrans &) const) &db::DCplxTrans::concat, gsi::arg ("t"), "@brief Multiplication (concatenation) of transformations\n" @@ -1088,43 +1130,62 @@ Class decl_DCplxTrans ("db", "DCplxTrans", ); Class decl_CplxTrans ("db", "CplxTrans", - constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the input space from floating-point units to integer units. " + "Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the output space from integer units to floating-point units. " + "Formally, the CplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n" + "The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. " + "Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * from_dbu' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - method_ext ("to_itrans", &cplxtrans_to_icplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer input and output coordinates\n" "\n" - "The database unit can be specified to translate the floating-point coordinate " - "displacement in micron units to an integer-coordinate displacement in database units. The displacement's' " - "coordinates will be divided by the database unit.\n" + "This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor:\n" "\n" - "This method has been introduced in version 0.25." + "@code\n" + "itrans = RBA::ICplxTrans::new(trans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_vtrans", &cplxtrans_to_icplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer output and floating-point input coordinates\n" "\n" - "The database unit can be specified to translate the floating-point coordinate " - "displacement in micron units to an integer-coordinate displacement in database units. The displacement's' " - "coordinates will be divided by the database unit.\n" + "This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor:\n" "\n" - "This method has been introduced in version 0.25." + "@code\n" + "vtrans = RBA::VCplxTrans::new(trans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_trans", &cplxtrans_to_cplxtrans, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with floating-point input coordinates\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor:\n" + "\n" + "@code\n" + "dtrans = RBA::DCplxTrans::new(trans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + method ("*!", (db::DCplxTrans (db::CplxTrans::*) (const db::VCplxTrans &) const) &db::CplxTrans::concat, gsi::arg ("t"), "@brief Multiplication (concatenation) of transformations\n" @@ -1178,43 +1239,77 @@ Class decl_CplxTrans ("db", "CplxTrans", ); Class decl_ICplxTrans ("db", "ICplxTrans", - constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer coordinate transformation from another coordinate flavour\n" "\n" - "This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'." + "The 'dbu' argument is used to transform the input space and output space from floating-point units to integer units and vice versa. " + "Formally, the ICplxTrans transformation is initialized with 'to_dbu * trans * from_dbu' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)' and 'to_dbu' is the transformation into DBU space, or more " + "precisely 'VCplxTrans(mag=1/dbu)'.\n" + "\n" + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new|#from_trans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_trans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer coordinate transformation from another coordinate flavour\n" + "\n" + "The 'dbu' argument is used to transform the output space from floating-point units to integer units. " + "Formally, the CplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more " + "precisely 'VCplxTrans(mag=1/dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates an integer coordinate transformation from another coordinate flavour\n" + "\n" + "The 'dbu' argument is used to transform the input space from floating-point units to integer units. " + "Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation " + "into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n" "\n" - "This constructor has been introduced in version 0.25." + "This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29." ) + - method_ext ("to_itrans", &cplxtrans_to_dcplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with floating-point input and output coordinates\n" "\n" "The database unit can be specified to translate the integer coordinate " "displacement in database units to a floating-point displacement in micron units. The displacement's' " "coordinates will be multiplied with the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_itrans' use the conversion constructor:\n" + "\n" + "@code\n" + "dtrans = RBA::DCplxTrans::new(itrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_vtrans", &cplxtrans_to_dcplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with floating-point output coordinates\n" "\n" "The database unit can be specified to translate the integer coordinate " "displacement in database units to a floating-point displacement in micron units. The displacement's' " "coordinates will be multiplied with the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_vtrans' use the conversion constructor:\n" + "\n" + "@code\n" + "trans = RBA::CplxTrans::new(itrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + - method_ext ("to_trans", &cplxtrans_to_cplxtrans, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with floating-point input coordinates\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_trans' use the conversion constructor:\n" + "\n" + "@code\n" + "vtrans = RBA::VCplxTrans::new(itrans, dbu)\n" + "@/code\n" + "\n" + "This method has been introduced in version 0.25 and was deprecated in version 0.29." ) + method ("*!", (db::VCplxTrans (db::ICplxTrans::*) (const db::VCplxTrans &) const) &db::ICplxTrans::concat, gsi::arg ("t"), "@brief Multiplication (concatenation) of transformations\n" @@ -1256,37 +1351,76 @@ Class decl_ICplxTrans ("db", "ICplxTrans", ); Class decl_VCplxTrans ("db", "VCplxTrans", - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n" + "\n" + "The 'dbu' argument is used to transform the output space from floating-point units to integer units. " + "Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation " + "into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n" + "\n" + "The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n" + "\n" + "The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. " + "Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans * to_dbu' where 'to_dbu' is the transformation " + "into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n" + "\n" + "The 'dbu' argument has been added in version 0.29." ) + - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), gsi::arg ("dbu", 1.0), + "@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n" + "\n" + "The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. " + "Formally, the VCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation " + "into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n" + "\n" + "The 'dbu' argument has been added in version 0.29." ) + - method_ext ("to_itrans", &cplxtrans_to_dcplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with floating-point output coordinates\n" "\n" "The database unit can be specified to translate the integer coordinate " "displacement in database units to a floating-point displacement in micron units. The displacement's' " "coordinates will be multiplied with the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_itrans' use the conversion constructor:\n" + "\n" + "@code\n" + "dtrans = RBA::DCplxTrans::new(vtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been deprecated in version 0.29." ) + - method_ext ("to_vtrans", &cplxtrans_to_dcplxtrans, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, gsi::arg ("dbu", 1.0), "@brief Converts the transformation to another transformation with integer input and floating-point output coordinates\n" "\n" "The database unit can be specified to translate the integer coordinate " "displacement in database units to an floating-point displacement in micron units. The displacement's' " "coordinates will be multiplied with the database unit.\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_vtrans' use the conversion constructor:\n" + "\n" + "@code\n" + "trans = RBA::CplxTrans::new(vtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been deprecated in version 0.29." ) + - method_ext ("to_trans", &cplxtrans_to_cplxtrans, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, "@brief Converts the transformation to another transformation with integer input coordinates\n" "\n" - "This method has been introduced in version 0.25." + "This method is redundant with the conversion constructors and is ill-named. " + "Instead of 'to_trans' use the conversion constructor:\n" + "\n" + "@code\n" + "itrans = RBA::ICplxTrans::new(vtrans, dbu)\n" + "@/code\n" + "\n" + "This method has been deprecated in version 0.29." ) + method ("*!", (db::VCplxTrans (db::VCplxTrans::*) (const db::DCplxTrans &) const) &db::VCplxTrans::concat, gsi::arg ("t"), "@brief Multiplication (concatenation) of transformations\n" From f476416ce1ff84ba3df86a004376ed4a335c6fec Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Fri, 5 Jan 2024 23:44:54 +0100 Subject: [PATCH 2/2] Added tests --- testdata/ruby/dbTransTest.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/testdata/ruby/dbTransTest.rb b/testdata/ruby/dbTransTest.rb index a778b07cba..b5d6f3444e 100644 --- a/testdata/ruby/dbTransTest.rb +++ b/testdata/ruby/dbTransTest.rb @@ -626,6 +626,37 @@ def test_5_CplxTrans_Hash end + # Complex trans conversions, issue #1586 + def test_6_CplxTransConversions + + itrans = RBA::ICplxTrans::new(1.0, 0.0, false, RBA::Vector::new(1, 2)) + vtrans = RBA::VCplxTrans::new(1000.0, 0.0, false, RBA::Vector::new(1, 2)) + dtrans = RBA::DCplxTrans::new(1.0, 0.0, false, RBA::DVector::new(1, 2)) + ctrans = RBA::CplxTrans::new(0.001, 0.0, false, RBA::DVector::new(1, 2)) + + assert_equal(RBA::ICplxTrans::new(vtrans, 0.001).to_s, "r0 *1 1,2") + assert_equal(RBA::ICplxTrans::new(dtrans, 0.001).to_s, "r0 *1 1000,2000") + assert_equal(RBA::ICplxTrans::new(ctrans, 0.001).to_s, "r0 *1 1000,2000") + + assert_equal(RBA::VCplxTrans::new(itrans, 0.001).to_s, "r0 *1000 1,2") + assert_equal(RBA::VCplxTrans::new(dtrans, 0.001).to_s, "r0 *1000 1000,2000") + assert_equal(RBA::VCplxTrans::new(ctrans, 0.001).to_s, "r0 *1000 1000,2000") + + assert_equal(RBA::DCplxTrans::new(itrans, 0.001).to_s, "r0 *1 0.001,0.002") + assert_equal(RBA::DCplxTrans::new(vtrans, 0.001).to_s, "r0 *1 0.001,0.002") + assert_equal(RBA::DCplxTrans::new(ctrans, 0.001).to_s, "r0 *1 1,2") + + assert_equal(RBA::CplxTrans::new(itrans, 0.001).to_s, "r0 *0.001 0.001,0.002") + assert_equal(RBA::CplxTrans::new(vtrans, 0.001).to_s, "r0 *0.001 0.001,0.002") + assert_equal(RBA::CplxTrans::new(dtrans, 0.001).to_s, "r0 *0.001 1,2") + + # issue #1586 (NOTE: to_itrans is deprecated) + t = RBA::DCplxTrans::new(1.0, 45.0, false, 12.345678, 20.000000) + assert_equal(t.to_itrans(0.001).to_s, "r45 *1 12345.678,20000") + assert_equal(RBA::ICplxTrans::new(t, 0.001).to_s, "r45 *1 12345.678,20000") + + end + end load("test_epilogue.rb")