framecurve 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/framecurve.gemspec +1 -1
- data/lib/framecurve.rb +1 -1
- data/lib/framecurve/validator.rb +13 -0
- data/test/test_framecurve_validator.rb +10 -0
- metadata +9 -9
data/framecurve.gemspec
CHANGED
data/lib/framecurve.rb
CHANGED
data/lib/framecurve/validator.rb
CHANGED
@@ -62,6 +62,19 @@ class Framecurve::Validator
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
def verify_non_negative_source_and_destination_frames(curve)
|
66
|
+
curve.each_with_index do | t, i |
|
67
|
+
next unless t.tuple?
|
68
|
+
|
69
|
+
line_no = i + 1
|
70
|
+
if t.at < 0
|
71
|
+
@errors.push("The tuple %d had a negative at_frame value (%d). The spec mandates positive frames." % [line_no, t.at])
|
72
|
+
elsif t.value < 0
|
73
|
+
@errors.push("The tuple %d had a negative use_frame_of_source value (%.5f). The spec mandates positive frames." % [line_no, t.value])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
65
78
|
def verify_file_naming(curve)
|
66
79
|
return unless curve.respond_to?(:filename) && curve.filename
|
67
80
|
unless curve.filename =~ /\.framecurve\.txt$/
|
@@ -75,4 +75,14 @@ class TestFramecurveValidator < Test::Unit::TestCase
|
|
75
75
|
assert v.any_errors?
|
76
76
|
assert_equal ["The frame sequencing is out of order (expected [1, 10] but got [10, 1]). The framecurve spec mandates that frames are recorded sequentially"], v.errors
|
77
77
|
end
|
78
|
+
|
79
|
+
def test_should_error_out_with_neg_source_and_dest_values
|
80
|
+
c = Framecurve::Curve.new( Framecurve::Tuple.new(-10, 123.4), Framecurve::Tuple.new(1, -345.67) )
|
81
|
+
v = Framecurve::Validator.new
|
82
|
+
v.validate(c)
|
83
|
+
assert v.any_errors?
|
84
|
+
errs = ["The tuple 1 had a negative at_frame value (-10). The spec mandates positive frames.",
|
85
|
+
"The tuple 2 had a negative use_frame_of_source value (-345.67000). The spec mandates positive frames."]
|
86
|
+
assert_equal errs, v.errors
|
87
|
+
end
|
78
88
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: framecurve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &10767710 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10767710
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jeweler
|
27
|
-
requirement: &
|
27
|
+
requirement: &10767420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.6.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10767420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &10767130 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *10767130
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: cli_test
|
49
|
-
requirement: &
|
49
|
+
requirement: &10766770 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *10766770
|
58
58
|
description: ! ' Parser, validation and interpolation'
|
59
59
|
email: me@julik.nl
|
60
60
|
executables:
|