From: Nathaniel Talbott Date: 2002-03-30T09:59:18+09:00 Subject: RE: RUNIT: mixin instead of inheriting? Phil Tomson [mailto:ptkwt@aracnet.com] wrote: > Yes, it's rather odd. Let me try to explain: > > I'm making this module that allows one to describe & simulate > hardware in Ruby (RHDL). Now, in mainstream Hardware > Description Languages(HDL) the designer will design the > hardware model and then make something called a Testbench > which is also written in the HDL. The Testbench is used to > determine if the model of the hardware being described is > functionally correct. This is in some sense similar to the > concept of Unit testing in the software world. In a > testbench you test the value of certain signals at certain > times and if they don't match what you expect you can assert an error. > > So my idea was that if Test::Unit was mixed in, the design > would contain the testbench as well. Perhaps it doesn't make > much sense, though. I can certainly live with the current > way of doing it, but the potential advantage of the other is > that I could put asserts within the actual design itself and > have their pass/fail status be tracked as well. I wonder if it would be enough to simply include Test::Unit::Assertions (which is already a module)? Then you could use the assertions in the TestBench code, and wrap the running of the TestBench in a rescue for Test::Unit::AssertionFailedError. You don't get all of the test running stuff, but it seems like the running of a TestBench is probably different than the running of a TestCase (although that's just a guess). Would that work? Nathaniel <:((>< + - - | RoleModel Software, Inc. | EQUIP VI