2020-11-25 23:23:46 +01:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace ln.json.tests
|
|
|
|
{
|
|
|
|
public class JSONTests
|
|
|
|
{
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_00_Primitives()
|
|
|
|
{
|
|
|
|
JSONValue jsonFloat = JSONParser.Parse("1234.564");
|
|
|
|
|
|
|
|
Assert.IsTrue(jsonFloat is JSONNumber);
|
|
|
|
Assert.AreEqual(1234.564, jsonFloat.ToNative());
|
|
|
|
|
|
|
|
JSONValue jsonInteger = JSONParser.Parse("635462");
|
|
|
|
|
|
|
|
Assert.IsTrue(jsonFloat is JSONNumber);
|
|
|
|
Assert.AreEqual(635462, jsonInteger.ToNative());
|
|
|
|
|
|
|
|
|
|
|
|
Assert.Pass();
|
|
|
|
}
|
2020-12-09 14:49:30 +01:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestArrayParser()
|
|
|
|
{
|
|
|
|
JSONParser.Parse("[]");
|
|
|
|
JSONParser.Parse("[ ]");
|
|
|
|
JSONParser.Parse("[\t]");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestObjectParser()
|
|
|
|
{
|
|
|
|
JSONParser.Parse("{}");
|
|
|
|
JSONParser.Parse("{ }");
|
|
|
|
JSONParser.Parse("{\t}");
|
|
|
|
}
|
|
|
|
|
2020-11-25 23:23:46 +01:00
|
|
|
}
|
|
|
|
}
|