-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
namespace Application | ||
{ | ||
public class NewClass | ||
{ | ||
public NewClass() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// | ||
// THIS FILE HAS BEEN GENERATED AUTOMATICALLY | ||
// DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING | ||
// | ||
// GENERATED USING @colyseus/schema 0.4.32 | ||
// | ||
|
||
using Colyseus.Schema; | ||
|
||
namespace SchemaTest.PrimitiveTypes { | ||
public class PrimitiveTypes : Schema { | ||
[Type(0, "int8")] | ||
public int int8 = 0; | ||
|
||
[Type(1, "uint8")] | ||
public uint uint8 = 0; | ||
|
||
[Type(2, "int16")] | ||
public short int16 = 0; | ||
|
||
[Type(3, "uint16")] | ||
public ushort uint16 = 0; | ||
|
||
[Type(4, "int32")] | ||
public int int32 = 0; | ||
|
||
[Type(5, "uint32")] | ||
public uint uint32 = 0; | ||
|
||
[Type(6, "int64")] | ||
public long int64 = 0; | ||
|
||
[Type(7, "uint64")] | ||
public ulong uint64 = 0; | ||
|
||
[Type(8, "float32")] | ||
public float float32 = 0; | ||
|
||
[Type(9, "float64")] | ||
public double float64 = 0; | ||
|
||
[Type(10, "number")] | ||
public float varint = 0; | ||
|
||
[Type(11, "string")] | ||
public string str = ""; | ||
|
||
[Type(12, "boolean")] | ||
public bool boolean = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using NUnit.Framework; | ||
using SchemaTest.PrimitiveTypes; | ||
using UnityEngine; | ||
|
||
public class SchemaDeserializerTest | ||
{ | ||
|
||
[SetUp] | ||
public void Init() | ||
{ | ||
|
||
} | ||
|
||
[TearDown] | ||
public void Dispose() | ||
{ | ||
|
||
} | ||
|
||
[Test] | ||
public void PrimitiveTypesTest() | ||
{ | ||
PrimitiveTypes state = new PrimitiveTypes(); | ||
|
||
byte[] bytes = { 0, 128, 1, 255, 2, 0, 128, 3, 255, 255, 4, 0, 0, 0, 128, 5, 255, 255, 255, 255, 6, 0, 0, 0, 0, 0, 0, 0, 128, 7, 255, 255, 255, 255, 255, 255, 31, 0, 8, 255, 255, 127, 255, 9, 255, 255, 255, 255, 255, 255, 239, 127, 10, 205, 208, 7, 11, 171, 72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 12, 1 }; | ||
state.Decode(bytes); | ||
|
||
Assert.AreEqual(state.int8, -128); | ||
Assert.AreEqual(state.uint8, 255); | ||
Assert.AreEqual(state.int16, -32768); | ||
Assert.AreEqual(state.uint16, 65535); | ||
Assert.AreEqual(state.int32, -2147483648); | ||
Assert.AreEqual(state.uint32, 4294967295); | ||
Assert.AreEqual(state.int64, -9223372036854775808); | ||
Assert.AreEqual(state.uint64, 9007199254740991); | ||
Assert.AreEqual(state.float32, -3.40282347E+38f); | ||
Assert.AreEqual(state.float64, 1.7976931348623157e+308); | ||
Assert.AreEqual(state.varint, 2000); | ||
Assert.AreEqual(state.str, "Hello world"); | ||
Assert.AreEqual(state.boolean, true); | ||
} | ||
|
||
} |