nwn-lib 0.4.10.1 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.join(File.dirname(__FILE__), 'kivinen_expect')
3
+
4
+ describe "Kivinen Support" do
5
+
6
+ it "yields all fields correctly" do
7
+ g = Gff.read(StringIO.new(WELLFORMED_GFF), :gff)
8
+
9
+ expected = KIVINEN_EXPECT.dup
10
+
11
+ NWN::Gff::Kivinen.format(g, true) do |label, entry|
12
+ w = expected.shift
13
+ label.should == w[0]
14
+ case entry
15
+ when Float
16
+ entry.should be_close(w[1], 0.001)
17
+ else
18
+ entry.should == w[1]
19
+ end
20
+ end
21
+ end
22
+ end
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,8 @@ unless Object.const_defined?('NWN')
10
10
  include NWN
11
11
  end
12
12
 
13
+ NWN.setting(:debug, 0)
14
+
13
15
  GffFieldValidations = {
14
16
  :void => [[""], []],
15
17
  :byte => [[0, 255], [256, -1]],
data/spec/struct_spec.rb CHANGED
@@ -79,4 +79,14 @@ describe "Gff::Struct" do
79
79
  t = Gff::Reader.read(StringIO.new WELLFORMED_GFF)
80
80
  Gff::Reader.read(StringIO.new t.to_gff).should == t
81
81
  end
82
+
83
+ Gff::Field::DEFAULT_VALUES.each {|type, val|
84
+ it "uses default values for add_#{type}, add_field .., #{type}" do
85
+ struct = Gff::Struct.new
86
+ struct.add_field 'explicit', type
87
+ struct.send("add_#{type}".to_sym, 'implicit')
88
+ (struct / 'explicit$').should == val
89
+ (struct / 'implicit$').should == val
90
+ end
91
+ }
82
92
  end
data/spec/twoda_spec.rb CHANGED
@@ -1,13 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), 'spec_helper')
2
2
 
3
3
  describe TwoDA::Table do
4
- before do
5
- NWN.setting(:debug, "0")
6
- end
7
- after do
8
- NWN.setting(:debug, nil)
9
- end
10
-
11
4
  it "parses wellformed files" do
12
5
  proc { subject.parse(TWODA_WELLFORMED) }.should_not raise_error ArgumentError
13
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nwn-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10.1
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernhard Stoeckner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-15 00:00:00 +01:00
12
+ date: 2009-11-20 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -45,14 +45,18 @@ files:
45
45
  - spec/key_spec.rb
46
46
  - spec/bin_gff_spec.rb
47
47
  - spec/bin_erf_spec.rb
48
+ - spec/kivinen_expect.rb
48
49
  - spec/field_spec.rb
49
50
  - spec/cexolocstr_spec.rb
51
+ - spec/kivinen_spec.rb
50
52
  - spec/erf_spec.rb
51
53
  - spec/struct_spec.rb
52
54
  - spec/res_spec.rb
53
55
  - spec/tlk_spec.rb
56
+ - spec/json_spec.rb
54
57
  - spec/twoda_spec.rb
55
58
  - spec/spec_helper.rb
59
+ - spec/data_type_spec.rb
56
60
  - spec/wellformed_gff.bic
57
61
  - lib/nwn/erf.rb
58
62
  - lib/nwn/json_support.rb