test/unit/rut_computations_test.rb in rutcl-1.0.0 vs test/unit/rut_computations_test.rb in rutcl-1.0.1
- old
+ new
@@ -1,52 +1,52 @@
#coding: utf-8
require 'test_helper'
-describe Rut do
+describe Rutcl::Rut do
describe "dv" do
it "should only accept numbers" do
- assert_raises(ArgumentError) { Rut.dv "hola" }
- assert_raises(ArgumentError) { Rut.dv "1234a5678" }
+ assert_raises(ArgumentError) { Rutcl::Rut.dv "hola" }
+ assert_raises(ArgumentError) { Rutcl::Rut.dv "1234a5678" }
end
describe "calculations" do
describe "for numeric ruts" do
it "should work with short ruts" do
- Rut.dv(1).must_equal 9
- Rut.dv(2).must_equal 7
- Rut.dv(12).must_equal 4
- Rut.dv(104).must_equal "k"
- Rut.dv(1000).must_equal 6
- Rut.dv(10000).must_equal 5
- Rut.dv(100001).must_equal 2
+ Rutcl::Rut.dv(1).must_equal 9
+ Rutcl::Rut.dv(2).must_equal 7
+ Rutcl::Rut.dv(12).must_equal 4
+ Rutcl::Rut.dv(104).must_equal "k"
+ Rutcl::Rut.dv(1000).must_equal 6
+ Rutcl::Rut.dv(10000).must_equal 5
+ Rutcl::Rut.dv(100001).must_equal 2
end
it "should work with large ruts" do
- Rut.dv(7956772).must_equal 8
- Rut.dv(8457638).must_equal 7
- Rut.dv(5954893).must_equal "k"
- Rut.dv(16365637).must_equal "k"
- Rut.dv(18439790).must_equal 0
- Rut.dv(11111111).must_equal 1
- Rut.dv(14569484).must_equal 1
+ Rutcl::Rut.dv(7956772).must_equal 8
+ Rutcl::Rut.dv(8457638).must_equal 7
+ Rutcl::Rut.dv(5954893).must_equal "k"
+ Rutcl::Rut.dv(16365637).must_equal "k"
+ Rutcl::Rut.dv(18439790).must_equal 0
+ Rutcl::Rut.dv(11111111).must_equal 1
+ Rutcl::Rut.dv(14569484).must_equal 1
end
end
describe "for string ruts" do
it "should work correct dvs" do
- Rut.dv("1").must_equal 9
- Rut.dv("2").must_equal 7
- Rut.dv("12").must_equal 4
- Rut.dv("104").must_equal "k"
- Rut.dv("1000").must_equal 6
- Rut.dv("10000").must_equal 5
- Rut.dv("100001").must_equal 2
+ Rutcl::Rut.dv("1").must_equal 9
+ Rutcl::Rut.dv("2").must_equal 7
+ Rutcl::Rut.dv("12").must_equal 4
+ Rutcl::Rut.dv("104").must_equal "k"
+ Rutcl::Rut.dv("1000").must_equal 6
+ Rutcl::Rut.dv("10000").must_equal 5
+ Rutcl::Rut.dv("100001").must_equal 2
end
it "should work with large ruts" do
- Rut.dv("7956772").must_equal 8
- Rut.dv("8457638").must_equal 7
- Rut.dv("5954893").must_equal "k"
- Rut.dv("16365637").must_equal "k"
- Rut.dv("18439790").must_equal 0
- Rut.dv("11111111").must_equal 1
- Rut.dv("14569484").must_equal 1
+ Rutcl::Rut.dv("7956772").must_equal 8
+ Rutcl::Rut.dv("8457638").must_equal 7
+ Rutcl::Rut.dv("5954893").must_equal "k"
+ Rutcl::Rut.dv("16365637").must_equal "k"
+ Rutcl::Rut.dv("18439790").must_equal 0
+ Rutcl::Rut.dv("11111111").must_equal 1
+ Rutcl::Rut.dv("14569484").must_equal 1
end
end
end
end
end