From: serialhex Date: 2011-06-05T03:33:23+09:00 Subject: theres got to be a better way to test this... --000e0ce0ed42c551a704a4e71a51 Content-Type: text/plain; charset=ISO-8859-1 ok, so i'm writing some tests to check if requiring some files will work (right now it's all sorts of broken, but thats besides the point...) anyway, my (rather simple code) is this (so far): # some tests to see if the shogun libraries are loading properly require 'test/unit' class TestLibs < Test::Unit::TestCase def setup @libs = %w{ narray Classifier Distance Evaluation Kernel Preprocessor Structure Clustering Distribution Library Regression } end def test_load @libs.each do |lib| assert load_lib( lib ), "ERROR!!!!! #{lib} didn't load!!" end end def load_lib lib begin return require lib rescue LoadError return false end end end # end testing good-ness!! so, this works-ish. NArray loads, and throws no error, but when Classifier tries to load, the assert fires & the whole method stops, so my output is: # moar kode stufz $ ./test_libs.rb Loaded suite ./test_libs Started F Finished in 0.465465 seconds. 1) Failure: test_load(TestLibs) [./test_libs.rb:15]: ERROR!!!!! Classifier didn't load!! 1 tests, 2 assertions, 1 failures, 0 errors, 0 skips # no moar kode stufz i was wondering if there was a more elegant way to do this other than writing a bunch of ... IDEA!!! ffs!! idea is epic fail! ['twas to us metaprogramming to make the methods, but apparently it wont automagically run anything but test_* stuff ;( ] ok, so yeah, anyone have any ideas?? thanks in advance! hex -- > > Other than the fact Linux has a cool name, could someone explain why I > > should use Linux over BSD? > > No. That's it. The cool name, that is. We worked very hard on > creating a name that would appeal to the majority of people, and it > certainly paid off: thousands of people are using linux just to be able > to say "OS/2? Hah. I've got Linux. What a cool name". 386BSD made the > mistake of putting a lot of numbers and weird abbreviations into the > name, and is scaring away a lot of people just because it sounds too > technical. -- Linus Torvalds' follow-up to a question about Linux --000e0ce0ed42c551a704a4e71a51--