Skip to content

Instantly share code, notes, and snippets.

@mtodd
Created April 30, 2011 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtodd/949926 to your computer and use it in GitHub Desktop.
Save mtodd/949926 to your computer and use it in GitHub Desktop.
quantity-specs.log
quantity:activesupport-compatibility ruby-1.8.7$ gem install rspec -v "~> 1.2.9"
Fetching: rspec-1.2.9.gem (100%)
**************************************************
Thank you for installing rspec-1.2.9
Please be sure to read History.rdoc and Upgrade.rdoc
for useful information about this release.
**************************************************
Successfully installed rspec-1.2.9
1 gem installed
quantity:activesupport-compatibility ruby-1.8.7$ rake -T
(in /Users/mtodd/Projects/Contributions/quantity)
rake spec # Run specs
rake tracespec # specs with backtrace
rake traceunit # unit specs with backtrace
rake unit # Run unit specs
rake yard # Generate YARD Documentation
quantity:activesupport-compatibility ruby-1.8.7$ rake spec
(in /Users/mtodd/Projects/Contributions/quantity)
Quantity
instantiation
should be instantiated from numbers
should work with alias names
should know what it measures
should know its units
should have a string representation
conversions
converts from one type to another
converts from one type to another when not using the reference value for that dimension
fails to convert things that do not measure the same dimension
converts derived units
converts derived units to named units
reduces derived units
math operations
equality
enforces exact equality
does not intern quantities
enforces equality across a dimension
does not find quantities on different dimensions to be equal
general
supports abs
supports @-
supports @+
supports %
supports modulo
supports round
supports truncate
supports ceil
supports floor
supports divmod
supports zero?
addition and subtraction
adds quantities of the same thing
adds quantities of the same dimension
adds numerics to quantities
adds quantities to numerics
does not add items of different types (FAILED - 1)
adds negative quantities
subtracts quantities of the same thing
subtracts quantities of the same dimension
does not add items of different types (FAILED - 2)
subtracts numerics from quantities
subtracts quantities from numerics
multiplication
multiplies quantities of the same unit
multiplies quantities of the same dimension
uses the unit on the right when multiplying across the same dimension (FAILED - 3)
multiplies complex units
multiplies units of different dimensions
division
divides numerics by quantities (FAILED - 4)
divides quantities by numerics
divides quantities of the same unit (FAILED - 5)
divides quantities of the same dimension (FAILED - 6)
divides quantities of different dimensions (FAILED - 7)
correctly calculates the value of a divided unit
exponentiation
raises quantities to positive powers
raises quantities to negative powers (FAILED - 8)
supports a cubed function
supports a squared function
does not raise to fractional powers
enumerable
should be comparable
1)
'Quantity math operations addition and subtraction does not add items of different types' FAILED
expected TypeError, got #<ArgumentError: Cannot add 12 meter to 24 picogram>
./spec/quantity.spec:167:
2)
'Quantity math operations addition and subtraction does not add items of different types' FAILED
expected TypeError, got #<ArgumentError: Cannot subtract 3650 picogram from 12 meter>
./spec/quantity.spec:183:
3)
'Quantity math operations multiplication uses the unit on the right when multiplying across the same dimension' FAILED
expected: :"foot^2",
got: "foot^2" (using ==)
./spec/quantity.spec:206:
4)
ArgumentError in 'Quantity math operations division divides numerics by quantities'
interning empty string
./spec/quantity.spec:220:
5)
ArgumentError in 'Quantity math operations division divides quantities of the same unit'
interning empty string
./spec/quantity.spec:228:
6)
ArgumentError in 'Quantity math operations division divides quantities of the same dimension'
interning empty string
./spec/quantity.spec:232:
7)
'Quantity math operations division divides quantities of different dimensions' FAILED
expected: :"kilogram/second",
got: "kilogram/second" (using ==)
./spec/quantity.spec:236:
8)
ArgumentError in 'Quantity math operations exponentiation raises quantities to negative powers'
Quantities can only be raised to fixed powers (given -1)
./spec/quantity.spec:251:
Finished in 0.021899 seconds
54 examples, 8 failures
rake aborted!
Command /Users/mtodd/.rvm/rubies/ruby-1.8.7-p334/bin/ruby -I"lib" "/Users/mtodd/.rvm/gems/ruby-1.8.7-p334/gems/rspec-1.2.9/bin/spec" "spec/quantity.spec" -cfn failed
(See full trace by running task with --trace)
quantity:activesupport-compatibility ruby-1.8.7$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment