UniVRM/UniJSON/Editor/Tests/MsgPack/StringTest.cs
ousttrue df85433628 Merge commit 'df5f79584312cf4f6cc7ec1d73a78f6ba475c9ad' as 'UniJSON'
Co-authored-by: Deatrathias <dmailsec@gmail.com>
Co-authored-by: dj-kusuha <dj.kusuha+github@gmail.com>
Co-authored-by: ousttrue <ousttrue@gmail.com>
Co-authored-by: yutopp <yutopp@gmail.com>
2018-12-28 20:38:39 +09:00

37 lines
953 B
C#

using NUnit.Framework;
using System;
using System.Linq;
namespace UniJSON.MsgPack
{
[TestFixture]
public class StringTest
{
[Test]
public void str()
{
var f = new MsgPackFormatter();
f.Value("文字列");
var bytes = f.GetStoreBytes();
var v = MsgPackParser.Parse(bytes).GetValue();
Assert.AreEqual("文字列", v);
}
[Test]
public void fix_str()
{
for (int i = 1; i < 32; ++i)
{
var str = String.Join("", Enumerable.Range(0, i).Select(_ => "0").ToArray());
var f = new MsgPackFormatter();
f.Value(str);
var bytes = f.GetStoreBytes();
var value = MsgPackParser.Parse(bytes);
Assert.AreEqual(i, ((String)value.GetValue()).Length);
}
}
}
}