|
| 1 | +using System; |
| 2 | +using Lucene.Net.Attributes; |
| 3 | +using NUnit.Framework; |
| 4 | +using Assert = Lucene.Net.TestFramework.Assert; |
| 5 | + |
| 6 | +namespace Lucene.Net.Store |
| 7 | +{ |
| 8 | + /* |
| 9 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 10 | + * contributor license agreements. See the NOTICE file distributed with |
| 11 | + * this work for additional information regarding copyright ownership. |
| 12 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 13 | + * (the "License"); you may not use this file except in compliance with |
| 14 | + * the License. You may obtain a copy of the License at |
| 15 | + * |
| 16 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | + * |
| 18 | + * Unless required by applicable law or agreed to in writing, software |
| 19 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | + * See the License for the specific language governing permissions and |
| 22 | + * limitations under the License. |
| 23 | + */ |
| 24 | + |
| 25 | + using LuceneTestCase = Lucene.Net.Util.LuceneTestCase; |
| 26 | + |
| 27 | + [TestFixture] |
| 28 | + [LuceneNetSpecific] |
| 29 | + public class TestByteArrayDataOutput : LuceneTestCase |
| 30 | + { |
| 31 | + [Test] |
| 32 | + public virtual void TestWriteString() |
| 33 | + { |
| 34 | + byte[] bytes = new byte[10]; |
| 35 | + ByteArrayDataOutput @out = new ByteArrayDataOutput(bytes); |
| 36 | + @out.WriteString("ABC"); |
| 37 | + |
| 38 | + ByteArrayDataInput @in = new ByteArrayDataInput(bytes); |
| 39 | + Assert.AreEqual("ABC", @in.ReadString()); |
| 40 | + } |
| 41 | + |
| 42 | + [Test] |
| 43 | + public virtual void TestWriteChars() |
| 44 | + { |
| 45 | + byte[] bytes = new byte[10]; |
| 46 | + ByteArrayDataOutput @out = new ByteArrayDataOutput(bytes); |
| 47 | + @out.WriteChars("ABC".AsSpan()); |
| 48 | + |
| 49 | + ByteArrayDataInput @in = new ByteArrayDataInput(bytes); |
| 50 | + Assert.AreEqual("ABC", @in.ReadString()); |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments