A game about forced loneliness, made by TACStudios
at master 41 lines 1.2 kB view raw
1using System; 2using System.Globalization; 3using System.Threading; 4using NUnit.Framework; 5using Unity.Collections; 6using Unity.Collections.LowLevel.Unsafe; 7using System.Text; 8using Unity.Burst; 9 10// change this to change the core type under test 11using FixedStringN = Unity.Collections.FixedString128Bytes; 12 13namespace FixedStringTests 14{ 15 [BurstCompile] 16 internal class FixedStringBurstTests 17 { 18 [BurstCompile] 19 static int BurstAppendFn(ref FixedStringN fs, in FixedString32Bytes other) 20 { 21 fs.Append(in other); 22 return fs.Length; 23 } 24 25 delegate int BurstAppendDelegate(ref FixedStringN a, in FixedString32Bytes b); 26 27 [Test] 28 public void TestBurstAppend() 29 { 30 var fp = BurstCompiler.CompileFunctionPointer<BurstAppendDelegate>(BurstAppendFn); 31 var invoke = fp.Invoke; 32 33 FixedStringN a = new FixedStringN("Hello "); 34 FixedString32Bytes b = new FixedString32Bytes("World"); 35 36 var len = invoke(ref a, b); 37 Assert.AreEqual(11, len); 38 Assert.AreEqual("Hello World", a.ToString()); 39 } 40 } 41}