theres got to be a better way to test this...

S

serialhex

[Note: parts of this message were removed to make it a legal post.]

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

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top