morellon / rrd-ffi

A ruby wrapper for librrd (rrdtool) using ffi.
MIT License
71 stars 20 forks source link

added rrd_xport #6

Closed schmurfy closed 13 years ago

schmurfy commented 13 years ago

I added the function with its test, the test itself is failing but I don't understand why (and I don't use rspec):

1) RRD::Wrapper when there is a rrd file should xport values Failure/Error: values.should == [["time", "Legend 0"], [1266933600, 0.0008], [1266937200, 0.0008], [1266940800, 0.0008], [1266944400, NaN]] expected: [["time", "Legend 0"], [1266933600, 0.0008], [1266937200, 0.0008], [1266940800, 0.0008], [1266944400, NaN]] got: [["time", "Legend 0"], [1266933600, 0.0008], [1266937200, 0.0008], [1266940800, 0.0008], [1266944400, NaN]](using ==) Diff:

./spec/rrd/wrapper_spec.rb:61:in `block (3 levels) in <top (required)>'

morellon commented 13 years ago

Hi schmurfy,

The problem with xport test is that the two NaN are different. I had problems like this before with no elegant solution. Thanks for contributing to the project. I will try to fix the test later this week and bump the gem version.

Cheers,

Thiago

schmurfy commented 13 years ago

strange thing for NaN, I thought it acted like some sort of constant. I did not added a high level xport method on the Graph class mainly because I do not uses it but it should not be too hard to implement if someone needs it.

The librrd C api is surely one of the most horrible I ever laid my eyes on xD

morellon commented 13 years ago

I also believed the same thing, but I found it is not a constant (the hard way). When someone have the need for a DSL level of the xport method I will implement it, no worries ;) The librrd is surely confusing, but at least they made a dynamic library, making it easy to integrate with other languages. I hoped other projects did the same (ffmpeg for example)