@@ -16,14 +16,23 @@ public class Tests
1616 /*private const int ExpectedSchemas = 13890;
1717 private const int ExpectedEnums = 2367;
1818 private const int ExpectedNames = 74908;*/
19+
1920 private const int ExpectedSchemas = 28697 ;
2021 private const int ExpectedEnums = 4391 ;
2122 private const int ExpectedNames = 141495 ;
2223
24+ private const int ExpectedSchemasV3 = 29520 ;
25+ private const int ExpectedEnumsV3 = 4484 ;
26+ private const int ExpectedNamesV3 = 144915 ;
27+
2328 private readonly string _uncompressedUsmapPath ;
2429 private readonly string _brotliCompressedUsmapPath ;
2530 private readonly string _oodleCompressedUsmapPath ;
2631
32+ private readonly string _uncompressedUsmapV3Path ;
33+ private readonly string _brotliCompressedUsmapV3Path ;
34+ private readonly string _oodleCompressedUsmapV3Path ;
35+
2736 public Tests ( )
2837 {
2938 var currentDir = Directory . GetCurrentDirectory ( ) ;
@@ -32,10 +41,14 @@ public Tests()
3241 _uncompressedUsmapPath = Path . Combine ( testFilesDir , "xx1.usmap" ) ;
3342 _brotliCompressedUsmapPath = Path . Combine ( testFilesDir , "br1.usmap" ) ;
3443 _oodleCompressedUsmapPath = Path . Combine ( testFilesDir , "oo1.usmap" ) ;
44+
45+ _uncompressedUsmapV3Path = Path . Combine ( testFilesDir , "xx2.usmap" ) ;
46+ _brotliCompressedUsmapV3Path = Path . Combine ( testFilesDir , "br2.usmap" ) ;
47+ _oodleCompressedUsmapV3Path = Path . Combine ( testFilesDir , "oo2.usmap" ) ;
3548 }
3649
3750 [ Fact ]
38- public void ParseUncompressedUsmapFromFile ( )
51+ public void ParseUncompressedFromFile ( )
3952 {
4053 var usmap = new Usmap ( _uncompressedUsmapPath ) ;
4154 Assert . Equal ( ExpectedSchemas , usmap . Schemas . Length ) ;
@@ -45,7 +58,7 @@ public void ParseUncompressedUsmapFromFile()
4558 }
4659
4760 [ Fact ]
48- public void ParseUncompressedUsmapFromStream ( )
61+ public void ParseUncompressedFromStream ( )
4962 {
5063 var usmap = new Usmap ( File . OpenRead ( _uncompressedUsmapPath ) ) ;
5164 Assert . Equal ( ExpectedSchemas , usmap . Schemas . Length ) ;
@@ -55,7 +68,7 @@ public void ParseUncompressedUsmapFromStream()
5568 }
5669
5770 [ Fact ]
58- public void ParseUncompressedUsmapFromBuffer ( )
71+ public void ParseUncompressedFromBuffer ( )
5972 {
6073 var buffer = File . ReadAllBytes ( _uncompressedUsmapPath ) ;
6174 var usmap = new Usmap ( buffer ) ;
@@ -138,4 +151,111 @@ public void ParseOodleCompressedFromBuffer()
138151 Assert . Equal ( ExpectedNames , usmap . Names . Length ) ;
139152 Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
140153 }
154+
155+ // v3
156+
157+ [ Fact ]
158+ public void ParseUncompressedV3FromFile ( )
159+ {
160+ var usmap = new Usmap ( _uncompressedUsmapV3Path ) ;
161+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
162+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
163+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
164+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
165+ }
166+
167+ [ Fact ]
168+ public void ParseUncompressedV3FromStream ( )
169+ {
170+ var usmap = new Usmap ( File . OpenRead ( _uncompressedUsmapV3Path ) ) ;
171+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
172+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
173+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
174+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
175+ }
176+
177+ [ Fact ]
178+ public void ParseUncompressedV3FromBuffer ( )
179+ {
180+ var buffer = File . ReadAllBytes ( _uncompressedUsmapV3Path ) ;
181+ var usmap = new Usmap ( buffer ) ;
182+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
183+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
184+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
185+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
186+ }
187+
188+ [ Fact ]
189+ public void ParseBrotliCompressedV3FromFile ( )
190+ {
191+ var usmap = new Usmap ( _brotliCompressedUsmapV3Path ) ;
192+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
193+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
194+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
195+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
196+ }
197+
198+ [ Fact ]
199+ public void ParseBrotliCompressedV3FromStream ( )
200+ {
201+ var usmap = new Usmap ( File . OpenRead ( _brotliCompressedUsmapV3Path ) ) ;
202+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
203+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
204+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
205+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
206+ }
207+
208+ [ Fact ]
209+ public void ParseBrotliCompressedV3FromBuffer ( )
210+ {
211+ var buffer = File . ReadAllBytes ( _brotliCompressedUsmapV3Path ) ;
212+ var usmap = new Usmap ( buffer ) ;
213+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
214+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
215+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
216+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
217+ }
218+
219+ [ Fact ]
220+ public void ParseOodleCompressedV3FromFile ( )
221+ {
222+ var options = new UsmapOptions
223+ {
224+ Oodle = OodleInstance
225+ } ;
226+ var usmap = new Usmap ( _oodleCompressedUsmapV3Path , options ) ;
227+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
228+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
229+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
230+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
231+ }
232+
233+ [ Fact ]
234+ public void ParseOodleCompressedV3FromStream ( )
235+ {
236+ var options = new UsmapOptions
237+ {
238+ Oodle = OodleInstance
239+ } ;
240+ var usmap = new Usmap ( File . OpenRead ( _oodleCompressedUsmapV3Path ) , options ) ;
241+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
242+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
243+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
244+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
245+ }
246+
247+ [ Fact ]
248+ public void ParseOodleCompressedV3FromBuffer ( )
249+ {
250+ var buffer = File . ReadAllBytes ( _oodleCompressedUsmapV3Path ) ;
251+ var options = new UsmapOptions
252+ {
253+ Oodle = OodleInstance
254+ } ;
255+ var usmap = new Usmap ( buffer , options ) ;
256+ Assert . Equal ( ExpectedSchemasV3 , usmap . Schemas . Length ) ;
257+ Assert . Equal ( ExpectedEnumsV3 , usmap . Enums . Length ) ;
258+ Assert . Equal ( ExpectedNamesV3 , usmap . Names . Length ) ;
259+ Assert . All ( usmap . Names , x => Assert . False ( string . IsNullOrEmpty ( x ) ) ) ;
260+ }
141261}
0 commit comments