@@ -2,18 +2,63 @@ require "./spec_helper"
22require " ./fixture/*"
33
44describe BinaryParser do
5- describe " uint32" do
5+ describe " # uint32" do
66 it " parse correct" do
7- parser = UInt32Parser .new.load(UINT32_FIXTURE )
7+ parser = UInt32Parser .new.load(UInt32Fixture )
88 expect(parser.value).to eq(42 )
99 end
1010 end
1111
12- describe " uint8 " do
12+ describe " #uint16 " do
1313 it " parse correct" do
14- parser = UInt8Parser .new.load(UINT8_FIXTURE )
14+ parser = UInt16Parser .new.load(UInt16Fixture )
1515 expect(parser.value).to eq(42 )
1616 end
1717 end
18+
19+ describe " #uint8" do
20+ it " parse correct" do
21+ parser = UInt8Parser .new.load(UInt8Fixture )
22+ expect(parser.value).to eq(42 )
23+ end
24+ end
25+
26+ describe " #int32" do
27+ it " parse correct" do
28+ parser = Int32Parser .new.load(Int32Fixture )
29+ expect(parser.value).to eq(42 )
30+ end
31+ end
32+
33+ describe " #int16" do
34+ it " parse correct" do
35+ parser = Int16Parser .new.load(Int16Fixture )
36+ expect(parser.value).to eq(42 )
37+ end
38+ end
39+
40+ describe " #int8" do
41+ it " parse correct" do
42+ parser = Int8Parser .new.load(Int8Fixture )
43+ expect(parser.value).to eq(42 )
44+ end
45+ end
46+
47+ describe " #array" do
48+ context " when fixed length" do
49+ it " parse correct" do
50+ parser = FixedArrayParser .new.load(FixedArrayFixture )
51+ expect(parser.arr).to eq([42 , 43 , 44 , 45 , 46 ])
52+ end
53+ end
54+
55+ context " when variable length" do
56+ it " parse correct" do
57+ parser = VarArrayParser .new.load(VarArrayFixture )
58+ expect(parser.size).to eq(5 )
59+ expect(parser.arr).to eq([42 , 43 , 44 , 45 , 46 ])
60+ end
61+ end
62+ end
1863end
1964
0 commit comments