[C#] Thread safe reads of Double and Float values from a ByteBuffer (#5900)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Thread safe reads of Double and Floats from ByteBuffer
This commit is contained in:
Derek Bailey
2020-05-07 14:33:29 -07:00
committed by GitHub
parent de89bd1933
commit 85ee4df7a2
5 changed files with 104 additions and 23 deletions

View File

@@ -608,5 +608,25 @@ namespace FlatBuffers.Test
var data = new dummyStruct[10];
Assert.Throws<ArgumentException>(() => uut.Put(1024, data));
}
[FlatBuffersTestMethod]
public void ByteBuffer_Get_Double()
{
var uut = new ByteBuffer(1024);
double value = 3.14159265;
uut.PutDouble(900, value);
double getValue = uut.GetDouble(900);
Assert.AreEqual(value, getValue);
}
[FlatBuffersTestMethod]
public void ByteBuffer_Get_Float()
{
var uut = new ByteBuffer(1024);
float value = 3.14159265F;
uut.PutFloat(900, value);
double getValue = uut.GetFloat(900);
Assert.AreEqual(value, getValue);
}
}
}