Issue #1322 (Net tracer tech component manipulation methods)

This commit is contained in:
Matthias Koefferlein 2023-04-07 10:20:17 +02:00
parent c6bfb03a18
commit 30d2992f56
2 changed files with 41 additions and 0 deletions

View File

@ -147,6 +147,14 @@ DB_PUBLIC gsi::Class<db::TechnologyComponent> &decl_dbTechnologyComponent ();
gsi::Class<db::NetTracerTechnologyComponent> decl_NetTracerTechnologyComponent (decl_dbTechnologyComponent (), "db", "NetTracerTechnologyComponent",
gsi::iterator ("each", static_cast<db::NetTracerTechnologyComponent::const_iterator (db::NetTracerTechnologyComponent::*) () const> (&db::NetTracerTechnologyComponent::begin), static_cast<db::NetTracerTechnologyComponent::const_iterator (db::NetTracerTechnologyComponent::*) () const> (&db::NetTracerTechnologyComponent::end),
"@brief Gets the connectivity definitions from the net tracer technology component.\n"
) +
gsi::method ("clear", &db::NetTracerTechnologyComponent::clear,
"@brief Removes all connectivity definitions.\n"
"This method has been introduced in version 0.28.7"
) +
gsi::method ("add", &db::NetTracerTechnologyComponent::push_back, gsi::arg ("connection"),
"@brief Adds a connectivity definition.\n"
"This method has been introduced in version 0.28.7"
),
"@brief Represents the technology information for the net tracer.\n"
"This class has been redefined in version 0.28 and re-introduced in version 0.28.3. Since version 0.28, "

View File

@ -158,6 +158,39 @@ class EXT_TestClass < TestBase
end
# Technology component
def test_4
c1 = RBA::NetTracerConnectivity::new
c1.connection("1/0", "3/0")
c1.name = "1to3"
c2 = RBA::NetTracerConnectivity::new
c2.connection("2/0", "3/0")
c2.name = "2to3"
tc = RBA::NetTracerTechnologyComponent::new
names = tc.each.collect { |c| c.name }.join(";")
assert_equal(names, "")
tc.add(c1)
names = tc.each.collect { |c| c.name }.join(";")
assert_equal(names, "1to3")
tc.add(c2)
names = tc.each.collect { |c| c.name }.join(";")
assert_equal(names, "1to3;2to3")
tc.clear
names = tc.each.collect { |c| c.name }.join(";")
assert_equal(names, "")
tc.add(c2)
names = tc.each.collect { |c| c.name }.join(";")
assert_equal(names, "2to3")
end
end
load("test_epilogue.rb")