public void Search_FindString_InMultiInt4StringBuffer() { var buffer = new Int4StringBuffer(TestStrings.DragulaLonger); m_Int4StringBuffer = buffer; var expectedIndex = TestStrings.DragulaLonger.Length - 3; m_Int4String = new Int4String(TestStrings.DragulaLonger[expectedIndex]); var array = m_Int4String.IntBytes; var index = Search.FindString(ref array, ref buffer.Data, ref buffer.Indices); Assert.AreEqual(expectedIndex, index); }
public void BeforeAll() { m_Result = new NativeArray <int>(1, Allocator.Persistent); m_SmallerStrings = TestData.RandomStrings(10, MinLength, MaxLength); m_SmallerBuffer = new Int4StringBuffer(m_SmallerStrings); // this is just to force this job to synchronously compile with Burst before perf test var tempInt4String = new Int4String(m_SmallerStrings[0]); m_SmallJob = new SingleStringSearchJobInt4(tempInt4String, m_SmallerBuffer, m_Result); m_SmallJob.Run(); var array = tempInt4String.IntBytes; Search.FindString(ref array, ref m_SmallerBuffer.Data, ref m_SmallerBuffer.Indices); tempInt4String.Dispose(); m_Strings = TestData.RandomStringsWithPrefix("/composition", StringCount, MinLength, MaxLength); m_Buffer = new Int4StringBuffer(m_Strings); }
public void Search_FindInt4String() { // second to last in the array, so we can test how long it takes to iterate StringCount times var searchForIndex = StringCount - 2; m_String = new Int4String(m_Strings[searchForIndex]); Profiler.BeginSample("Search_FindInt4String"); var array = m_String.IntBytes; var foundIndex = Search.FindString(ref array, ref m_Buffer.Data, ref m_Buffer.Indices); Assert.AreEqual(searchForIndex, foundIndex); Profiler.EndSample(); // jobs make their own profiler label m_Job = new SingleStringSearchJobInt4(m_String, m_Buffer, m_Result); m_Job.Run(); Assert.AreEqual(searchForIndex, m_Job.FoundIndex[0]); m_String.Dispose(); }
public void Int4String_ToString_OutputIsAlmostIdentical(string input) { m_Int4String = new Int4String(input, Allocator.Temp); Debug.Log($"input - {input}, output - {m_Int4String}"); Assert.AreEqual(input, m_Int4String.ToString()); }