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 ;
65using J2N . Text ;
76using Lucene . Net . Attributes ;
87using Lucene . Net . Util ;
98using NUnit . Framework ;
109using System ;
11- using System . Diagnostics . CodeAnalysis ;
1210using System . IO ;
1311using System . Text ;
1412using System . Threading . Tasks ;
13+ using Assert = Lucene . Net . TestFramework . Assert ;
1514
1615namespace Lucene . Net . Support . IO
1716{
@@ -53,8 +52,16 @@ public void TestRead_Span_Int64()
5352 fileStream . Flush ( flushToDisk : true ) ;
5453
5554 Span < byte > buffer = stackalloc byte [ Encoding . UTF8 . GetByteCount ( fileString ) ] ;
55+ // Test1: Original
5656 Assert . Greater ( fileStream . Read ( buffer , 0L ) , 0 ) ;
5757 Assert . IsTrue ( Encoding . UTF8 . GetString ( buffer ) . Equals ( fileString ) ) ;
58+ // Test2: Repeat
59+ buffer . Clear ( ) ;
60+ Assert . Greater ( fileStream . Read ( buffer , 0L ) , 0 ) ;
61+ Assert . IsTrue ( Encoding . UTF8 . GetString ( buffer ) . Equals ( fileString ) ) ;
62+ // Test3: Ensure reading past end returns 0
63+ buffer . Clear ( ) ;
64+ Assert . AreEqual ( expected : 0 , fileStream . Read ( buffer , buffer . Length + 1 ) ) ;
5865 }
5966
6067 [ Test ]
You can’t perform that action at this time.
0 commit comments