depix 1.1.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
- require File.dirname(__FILE__) + '/../lib/depix/dict'
2
1
  require 'test/unit'
3
2
 
4
- include Depix
3
+ include Depix::Binary
4
+ include Depix::Binary::Fields
5
5
 
6
6
  class BogusError < RuntimeError; end
7
7
 
@@ -515,33 +515,33 @@ class TestFieldEmit < Test::Unit::TestCase
515
515
  include FieldConformity
516
516
 
517
517
  def test_emit_short
518
- f = Field.emit_u8
518
+ f = U8Field.new
519
519
  conform_field!(f)
520
520
 
521
- f = Field.emit_u8(:desc => "Dick length")
521
+ f = U8Field.new(:desc => "Dick length")
522
522
  conform_field!(f)
523
523
  assert_equal "c", f.pattern
524
524
  assert_equal 1, f.length
525
525
  end
526
526
 
527
527
  def test_emit_double
528
- f = Field.emit_u16
528
+ f = U16Field.new
529
529
  conform_field!(f)
530
530
 
531
- f = Field.emit_u16(:desc => "Dick length")
531
+ f = U16Field.new(:desc => "Dick length")
532
532
  conform_field!(f)
533
533
  assert_equal "n", f.pattern
534
534
  assert_equal 2, f.length
535
535
  end
536
536
 
537
537
  def test_emit_char
538
- f = Field.emit_char
538
+ f = CharField.new
539
539
  conform_field!(f)
540
540
 
541
541
  assert_equal "A1", f.pattern
542
542
  assert_equal 1, f.length
543
-
544
- f = Field.emit_char :length => 3
543
+
544
+ f = CharField.new :length => 3
545
545
  conform_field!(f)
546
546
 
547
547
  assert_equal "A3", f.pattern
@@ -549,7 +549,7 @@ class TestFieldEmit < Test::Unit::TestCase
549
549
  end
550
550
 
551
551
  def test_emit_float
552
- f = Field.emit_r32
552
+ f = R32Field.new
553
553
  conform_field!(f)
554
554
 
555
555
  assert_equal "g", f.pattern
@@ -557,22 +557,22 @@ class TestFieldEmit < Test::Unit::TestCase
557
557
  end
558
558
  end
559
559
 
560
- class TestDict < Test::Unit::TestCase
560
+ class TestStructure < Test::Unit::TestCase
561
561
 
562
562
  def test_dict_has_a_fields_array
563
- dict_class = Class.new(Dict)
563
+ dict_class = Class.new(Structure)
564
564
  assert_respond_to dict_class, :fields
565
565
  assert_equal [], dict_class.fields
566
566
  end
567
567
 
568
568
  def test_dict_responds_to_validate
569
- dict_class = Class.new(Dict)
569
+ dict_class = Class.new(Structure)
570
570
  assert_respond_to dict_class, :validate!
571
571
  one = dict_class.new
572
572
  end
573
573
 
574
574
  def test_dict_fields_array_not_class_shared
575
- d1, d2 = (0..1).map{|_| Class.new(Dict) }
575
+ d1, d2 = (0..1).map{|_| Class.new(Structure) }
576
576
 
577
577
  d1.fields << 1
578
578
  d2.fields << 2
@@ -580,7 +580,7 @@ class TestDict < Test::Unit::TestCase
580
580
  end
581
581
 
582
582
  def test_dict_responds_to_emit_methods_from_fields
583
- c = Class.new(Dict)
583
+ c = Class.new(Structure)
584
584
 
585
585
  emitter_methods = Field.methods.grep(/^emit_/)
586
586
  emitter_methods.each do | m |
@@ -589,16 +589,16 @@ class TestDict < Test::Unit::TestCase
589
589
  end
590
590
 
591
591
  def test_empty_dict_has_empty_template
592
- c = Class.new(Dict)
592
+ c = Class.new(Structure)
593
593
  assert_respond_to c, :pattern
594
594
  assert_equal '', c.pattern
595
595
  assert_equal 0, c.length
596
596
  end
597
597
 
598
598
  def test_dict_assembles_template
599
- c = Class.new(Dict)
600
- c.fields << Field.emit_char
601
- c.fields << Field.emit_char
599
+ c = Class.new(Structure)
600
+ c.fields << CharField.new
601
+ c.fields << CharField.new
602
602
 
603
603
  assert_respond_to c, :pattern
604
604
  assert_equal 'A1A1', c.pattern
@@ -606,7 +606,7 @@ class TestDict < Test::Unit::TestCase
606
606
  end
607
607
 
608
608
  def test_dict_does_not_validate_inner_nil
609
- wrapper_class = Class.new(Dict) do
609
+ wrapper_class = Class.new(Structure) do
610
610
  u32 :bigint
611
611
  inner :invalid, AlwaysInvalidStruct
612
612
  end
@@ -615,7 +615,7 @@ class TestDict < Test::Unit::TestCase
615
615
  end
616
616
 
617
617
  def test_dict_calls_validate
618
- wrapper_class = Class.new(Dict) do
618
+ wrapper_class = Class.new(Structure) do
619
619
  u32 :bigint
620
620
  inner :invalid, AlwaysInvalidStruct, :req => true
621
621
  end
@@ -627,9 +627,9 @@ class TestDict < Test::Unit::TestCase
627
627
  end
628
628
  end
629
629
 
630
- class TestDictConsume < Test::Unit::TestCase
630
+ class TestStructureConsume < Test::Unit::TestCase
631
631
  def test_dict_consume
632
- c = Class.new(Dict)
632
+ c = Class.new(Structure)
633
633
  c.char :foo
634
634
  c.char :bar
635
635
 
@@ -644,13 +644,13 @@ class TestDictConsume < Test::Unit::TestCase
644
644
 
645
645
  end
646
646
 
647
- class TestDictEmitDSL < Test::Unit::TestCase
647
+ class TestStructureEmitDSL < Test::Unit::TestCase
648
648
 
649
649
  def test_dict_emit_char
650
- c = Class.new(Dict)
650
+ c = Class.new(Structure)
651
651
  c.char :tag, :desc => "Some name"
652
-
653
- assert c.instance_methods.include?("tag")
652
+ assert c.instance_methods.map{|e| e.to_s }.include?("tag"),
653
+ "Should create the tag accessor"
654
654
 
655
655
  assert_equal 1, c.fields.length
656
656
  field = c.fields[0]
@@ -661,10 +661,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
661
661
  end
662
662
 
663
663
  def test_dict_emit_char_with_length
664
- c = Class.new(Dict)
664
+ c = Class.new(Structure)
665
665
  c.char :joe, 3, :desc => "Some name"
666
666
 
667
- assert c.instance_methods.include?("joe")
667
+ assert c.instance_methods.map{|e| e.to_s }.include?("joe")
668
668
 
669
669
  assert_equal 1, c.fields.length
670
670
  field = c.fields[0]
@@ -674,10 +674,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
674
674
  end
675
675
 
676
676
  def test_dict_emit_u32
677
- c = Class.new(Dict)
677
+ c = Class.new(Structure)
678
678
  c.u32 :num, :desc => "Huge number"
679
679
 
680
- assert c.instance_methods.include?("num")
680
+ assert c.instance_methods.map{|e| e.to_s }.include?("num")
681
681
 
682
682
  assert_equal 1, c.fields.length
683
683
  field = c.fields[0]
@@ -687,10 +687,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
687
687
  end
688
688
 
689
689
  def test_dict_emit_r32
690
- c = Class.new(Dict)
690
+ c = Class.new(Structure)
691
691
  c.r32 :joe, :req => true
692
692
 
693
- assert c.instance_methods.include?("joe")
693
+ assert c.instance_methods.map{|e| e.to_s }.include?("joe")
694
694
 
695
695
  assert_equal 1, c.fields.length
696
696
  field = c.fields[0]
@@ -700,10 +700,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
700
700
  end
701
701
 
702
702
  def test_dict_emit_u8
703
- c = Class.new(Dict)
703
+ c = Class.new(Structure)
704
704
  c.u8 :joe, :req => true
705
705
 
706
- assert c.instance_methods.include?("joe")
706
+ assert c.instance_methods.map{|e| e.to_s }.include?("joe")
707
707
 
708
708
  assert_equal 1, c.fields.length
709
709
 
@@ -714,10 +714,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
714
714
  end
715
715
 
716
716
  def test_dict_emit_u16
717
- c = Class.new(Dict)
717
+ c = Class.new(Structure)
718
718
  c.u16 :joe, :req => true, :desc => "A little bit of numbers"
719
719
 
720
- assert c.instance_methods.include?("joe")
720
+ assert c.instance_methods.map{|e| e.to_s }.include?("joe")
721
721
 
722
722
  assert_equal 1, c.fields.length
723
723
 
@@ -729,10 +729,10 @@ class TestDictEmitDSL < Test::Unit::TestCase
729
729
  end
730
730
 
731
731
  def test_dict_emit_array
732
- c = Class.new(Dict)
732
+ c = Class.new(Structure)
733
733
  c.array :point, :u32, :desc => "Two coordinates"
734
734
 
735
- assert c.instance_methods.include?("point")
735
+ assert c.instance_methods.map{|e| e.to_s }.include?("point")
736
736
 
737
737
  assert_equal 1, c.fields.length
738
738
  field = c.fields[0]
@@ -744,12 +744,12 @@ class TestDictEmitDSL < Test::Unit::TestCase
744
744
  end
745
745
 
746
746
  def test_dict_emit_inner
747
- c = Class.new(Dict)
748
- c2 = Class.new(Dict)
747
+ c = Class.new(Structure)
748
+ c2 = Class.new(Structure)
749
749
 
750
750
  c.inner :nest, c2, :desc => "Nested struct"
751
751
 
752
- assert c.instance_methods.include?("nest")
752
+ assert c.instance_methods.map{|e| e.to_s }.include?("nest")
753
753
 
754
754
  assert_equal 1, c.fields.length
755
755
  f = c.fields[0]
@@ -760,13 +760,13 @@ class TestDictEmitDSL < Test::Unit::TestCase
760
760
  end
761
761
 
762
762
  def test_dict_emit_array_of_substructs
763
- c = Class.new(Dict)
764
- c2 = Class.new(Dict)
763
+ c = Class.new(Structure)
764
+ c2 = Class.new(Structure)
765
765
 
766
766
  c2.u32 :some_num
767
767
  c.array :inners, c2, 8, :desc => "Inner items"
768
768
 
769
- assert c.instance_methods.include?("inners")
769
+ assert c.instance_methods.map{|e| e.to_s }.include?("inners")
770
770
 
771
771
  assert_equal 1, c.fields.length
772
772
  f = c.fields[0]
@@ -781,9 +781,9 @@ class TestDictEmitDSL < Test::Unit::TestCase
781
781
  end
782
782
  end
783
783
 
784
- class TestDictCompact < Test::Unit::TestCase
784
+ class TestStructureCompact < Test::Unit::TestCase
785
785
  def test_only_with_interspersed_fields
786
- c = Class.new(Dict) do
786
+ c = Class.new(Structure) do
787
787
  u8 :some
788
788
  u8 :another
789
789
  u8 :third
@@ -808,7 +808,7 @@ class TestDictCompact < Test::Unit::TestCase
808
808
  end
809
809
 
810
810
  def test_only_with_fields_in_a_row
811
- c = Class.new(Dict) do
811
+ c = Class.new(Structure) do
812
812
  u8 :some
813
813
  u32 :another
814
814
  u8 :third
@@ -833,7 +833,7 @@ class TestDictCompact < Test::Unit::TestCase
833
833
  end
834
834
 
835
835
  def test_get_filler
836
- c = Class.new(Dict) do
836
+ c = Class.new(Structure) do
837
837
  u32 :some
838
838
  end
839
839
 
@@ -843,7 +843,7 @@ class TestDictCompact < Test::Unit::TestCase
843
843
  end
844
844
 
845
845
  def test_filler_parses_the_same
846
- c = Class.new(Dict) do
846
+ c = Class.new(Structure) do
847
847
  u8 :first
848
848
  u8 :second
849
849
  u8 :third
@@ -865,9 +865,9 @@ class TestDictCompact < Test::Unit::TestCase
865
865
  end
866
866
  end
867
867
 
868
- class TestDictApply < Test::Unit::TestCase
868
+ class TestStructureApply < Test::Unit::TestCase
869
869
  def test_apply
870
- struct = Class.new(Dict) do
870
+ struct = Class.new(Structure) do
871
871
  char :name, "julik".length
872
872
  char :module, "depix".length
873
873
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depix
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 6
10
- version: 1.1.6
4
+ prerelease:
5
+ version: 2.0.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Julik Tarkhanov
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-11-27 00:00:00 +01:00
13
+ date: 2011-06-14 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,44 +21,20 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
35
27
  - !ruby/object:Gem::Dependency
36
- name: rubyforge
28
+ name: hoe
37
29
  prerelease: false
38
30
  requirement: &id002 !ruby/object:Gem::Requirement
39
31
  none: false
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 7
44
- segments:
45
- - 2
46
- - 0
47
- - 4
48
- version: 2.0.4
35
+ version: 2.9.4
49
36
  type: :development
50
37
  version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: hoe
53
- prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 21
60
- segments:
61
- - 2
62
- - 6
63
- - 1
64
- version: 2.6.1
65
- type: :development
66
- version_requirements: *id003
67
38
  description: Read and write DPX file metadata
68
39
  email:
69
40
  - me@julik.nl
@@ -72,26 +43,28 @@ executables:
72
43
  extensions: []
73
44
 
74
45
  extra_rdoc_files:
75
- - DPX_HEADER_STRUCTURE.txt
76
46
  - History.txt
77
47
  - Manifest.txt
78
- - README.txt
48
+ - DPX_HEADER_STRUCTURE.rdoc
49
+ - README.rdoc
79
50
  files:
80
- - DPX_HEADER_STRUCTURE.txt
51
+ - DPX_HEADER_STRUCTURE.rdoc
81
52
  - History.txt
82
53
  - Manifest.txt
83
- - README.txt
54
+ - README.rdoc
84
55
  - Rakefile
85
56
  - bin/depix-describe
86
57
  - lib/depix.rb
87
- - lib/depix/benchmark.rb
58
+ - lib/depix/binary/descriptor.rb
59
+ - lib/depix/binary/fields.rb
60
+ - lib/depix/binary/structure.rb
88
61
  - lib/depix/compact_structs.rb
89
- - lib/depix/dict.rb
90
62
  - lib/depix/editor.rb
91
63
  - lib/depix/enums.rb
92
64
  - lib/depix/reader.rb
93
65
  - lib/depix/struct_explainer.rb
94
66
  - lib/depix/structs.rb
67
+ - lib/depix/synthetics.rb
95
68
  - test/samples/026_FROM_HERO_TAPE_5-3-1_MOV.0029.dpx
96
69
  - test/samples/E012_P001_L000002_lin.0001.dpx
97
70
  - test/samples/E012_P001_L000002_lin.0002.dpx
@@ -103,6 +76,7 @@ files:
103
76
  - test/samples/northlight_tc_mode_mismatch.dpx
104
77
  - test/test_depix.rb
105
78
  - test/test_dict.rb
79
+ - .gemtest
106
80
  has_rdoc: true
107
81
  homepage: http://guerilla-di.org/depix
108
82
  licenses: []
@@ -110,7 +84,7 @@ licenses: []
110
84
  post_install_message:
111
85
  rdoc_options:
112
86
  - --main
113
- - README.txt
87
+ - README.rdoc
114
88
  require_paths:
115
89
  - lib
116
90
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -118,23 +92,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
92
  requirements:
119
93
  - - ">="
120
94
  - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
95
  version: "0"
125
96
  required_rubygems_version: !ruby/object:Gem::Requirement
126
97
  none: false
127
98
  requirements:
128
99
  - - ">="
129
100
  - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
101
  version: "0"
134
102
  requirements: []
135
103
 
136
104
  rubyforge_project: guerilla-di
137
- rubygems_version: 1.3.7
105
+ rubygems_version: 1.6.2
138
106
  signing_key:
139
107
  specification_version: 3
140
108
  summary: Read and write DPX file metadata