File tree Expand file tree Collapse file tree
src/Lucene.Net.Tests/Support/IO Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// https://github.com/apache/harmony/blob/02970cb7227a335edd2c8457ebdde0195a735733/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataInputStreamTest.java
33// https://github.com/apache/harmony/blob/02970cb7227a335edd2c8457ebdde0195a735733/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/DataOutputStreamTest.java
44
5- using J2N . IO ;
6- using J2N . Text ;
75using Lucene . Net . Attributes ;
86using Lucene . Net . Util ;
97using NUnit . Framework ;
108using System ;
11- using System . Diagnostics . CodeAnalysis ;
129using System . IO ;
1310using System . Text ;
1411using System . Threading . Tasks ;
12+ using Assert = Lucene . Net . TestFramework . Assert ;
1513
1614namespace Lucene . Net . Support . IO
1715{
@@ -53,8 +51,16 @@ public void TestRead_Span_Int64()
5351 fileStream . Flush ( flushToDisk : true ) ;
5452
5553 Span < byte > buffer = stackalloc byte [ Encoding . UTF8 . GetByteCount ( fileString ) ] ;
54+ // Test1: Original
5655 Assert . Greater ( fileStream . Read ( buffer , 0L ) , 0 ) ;
5756 Assert . IsTrue ( Encoding . UTF8 . GetString ( buffer ) . Equals ( fileString ) ) ;
57+ // Test2: Repeat
58+ buffer . Clear ( ) ;
59+ Assert . Greater ( fileStream . Read ( buffer , 0L ) , 0 ) ;
60+ Assert . IsTrue ( Encoding . UTF8 . GetString ( buffer ) . Equals ( fileString ) ) ;
61+ // Test3: Ensure reading past end returns 0
62+ buffer . Clear ( ) ;
63+ Assert . AreEqual ( expected : 0 , fileStream . Read ( buffer , buffer . Length + 1 ) ) ;
5864 }
5965
6066 [ Test ]
You can’t perform that action at this time.
0 commit comments