<commit_before>﻿using NUnit.Framework;
using System;
using MiniMessagePack;
using System.Collections.Generic;

namespace MiniMessagePackTest
{
	[TestFixture ()]
	public class Test
	{
		[Test()]
		[TestCase(0,    new byte[] {0x00})]
		[TestCase(127,  new byte[] {0x7f})]
		[TestCase(-1,   new byte[] {0xff})]
		[TestCase(-32,  new byte[] {0xe0})]
		[TestCase(-33,  new byte[] {0xd0, 0xdf})]
		[TestCase(-128, new byte[] {0xd0, 0x80})]
		public void PackSbyteValue(sbyte value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}

		[Test()]
		[TestCase(0, new byte[] {0x00})]
		[TestCase(127, new byte[] {0x7f})]
		[TestCase(128, new byte[] {0xcc, 0x80})]
		[TestCase(255, new byte[] {0xcc, 0xff})]
		public void PackByteValue(byte value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}


		[Test()]
		[TestCase(0,       new byte[] {0x00})]
		[TestCase(127,     new byte[] {0x7f})]
		[TestCase(128,     new byte[] {0xcc, 0x80})]
		[TestCase(255,     new byte[] {0xcc, 0xff})]
		[TestCase(256,     new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(0x7fff,  new byte[] {0xcd, 0x7f, 0xff})]
		[TestCase(-1,      new byte[] {0xff})]
		[TestCase(-32,     new byte[] {0xe0})]
		[TestCase(-33,     new byte[] {0xd0, 0xdf})]
		[TestCase(-128,    new byte[] {0xd0, 0x80})]
		[TestCase(-129,    new byte[] {0xd1, 0xff, 0x7f})]
		[TestCase(-0x8000, new byte[] {0xd1, 0x80, 0x00})]
		public void PackShortValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)(short)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}


		[Test()]
		[TestCase(0,     new byte[] {0x00})]
		[TestCase(127,   new byte[] {0x7f})]
		[TestCase(128,   new byte[] {0xcc, 0x80})]
		[TestCase(255,   new byte[] {0xcc, 0xff})]
		[TestCase(256,   new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(65535, new byte[] {0xcd, 0xff, 0xff})]
		public void PackUshortValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)(ushort)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}

		[Test()]
		[TestCase(0,       new byte[] {0x00})]
		[TestCase(127,     new byte[] {0x7f})]
		[TestCase(128,     new byte[] {0xcc, 0x80})]
		[TestCase(255,     new byte[] {0xcc, 0xff})]
		[TestCase(256,     new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(0x7fff,  new byte[] {0xcd, 0x7f, 0xff})]
		[TestCase(0x10000, new byte[] {0xce, 0x00, 0x01, 0x00, 0x00})]
		[TestCase(0x7fffffff, new byte[] {0xce, 0x7f, 0xff, 0xff, 0xff})]
		[TestCase(-1,      new byte[] {0xff})]
		[TestCase(-32,     new byte[] {0xe0})]
		[TestCase(-33,     new byte[] {0xd0, 0xdf})]
		[TestCase(-128,    new byte[] {0xd0, 0x80})]
		[TestCase(-129,    new byte[] {0xd1, 0xff, 0x7f})]
		[TestCase(-0x8000, new byte[] {0xd1, 0x80, 0x00})]
		[TestCase(-0x8001, new byte[] {0xd2, 0xff, 0xff, 0x7f, 0xff})]
		public void PackIntValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();<commit_msg>fix test case. check boundary condition.<commit_after>﻿using NUnit.Framework;
using System;
using MiniMessagePack;
using System.Collections.Generic;

namespace MiniMessagePackTest
{
	[TestFixture ()]
	public class Test
	{
		[Test()]
		[TestCase(0,    new byte[] {0x00})]
		[TestCase(127,  new byte[] {0x7f})]
		[TestCase(-1,   new byte[] {0xff})]
		[TestCase(-32,  new byte[] {0xe0})]
		[TestCase(-33,  new byte[] {0xd0, 0xdf})]
		[TestCase(-128, new byte[] {0xd0, 0x80})]
		public void PackSbyteValue(sbyte value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}

		[Test()]
		[TestCase(0, new byte[] {0x00})]
		[TestCase(127, new byte[] {0x7f})]
		[TestCase(128, new byte[] {0xcc, 0x80})]
		[TestCase(255, new byte[] {0xcc, 0xff})]
		public void PackByteValue(byte value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}


		[Test()]
		[TestCase(0,       new byte[] {0x00})]
		[TestCase(127,     new byte[] {0x7f})]
		[TestCase(128,     new byte[] {0xcc, 0x80})]
		[TestCase(255,     new byte[] {0xcc, 0xff})]
		[TestCase(256,     new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(0x7fff,  new byte[] {0xcd, 0x7f, 0xff})]
		[TestCase(-1,      new byte[] {0xff})]
		[TestCase(-32,     new byte[] {0xe0})]
		[TestCase(-33,     new byte[] {0xd0, 0xdf})]
		[TestCase(-128,    new byte[] {0xd0, 0x80})]
		[TestCase(-129,    new byte[] {0xd1, 0xff, 0x7f})]
		[TestCase(-0x8000, new byte[] {0xd1, 0x80, 0x00})]
		public void PackShortValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)(short)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}


		[Test()]
		[TestCase(0,     new byte[] {0x00})]
		[TestCase(127,   new byte[] {0x7f})]
		[TestCase(128,   new byte[] {0xcc, 0x80})]
		[TestCase(255,   new byte[] {0xcc, 0xff})]
		[TestCase(256,   new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(65535, new byte[] {0xcd, 0xff, 0xff})]
		public void PackUshortValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
			var actual = packer.Pack ((object)(ushort)value);
			Assert.AreEqual (expected.Length, actual.Length, "length");
			for (int i = 0; i < expected.Length; i++) {
				Assert.AreEqual (expected [i], actual [i], "byte: " + i);
			}
		}

		[Test()]
		[TestCase(0,     new byte[] {0x00})]
		[TestCase(127,   new byte[] {0x7f})]
		[TestCase(128,   new byte[] {0xcc, 0x80})]
		[TestCase(255,   new byte[] {0xcc, 0xff})]
		[TestCase(256,   new byte[] {0xcd, 0x01, 0x00})]
		[TestCase(65535, new byte[] {0xcd, 0xff, 0xff})]
		[TestCase(65536, new byte[] {0xce, 0x00, 0x01, 0x00, 0x00})]
		[TestCase(0x7fffffff, new byte[] {0xce, 0x7f, 0xff, 0xff, 0xff})]
		[TestCase(-1,      new byte[] {0xff})]
		[TestCase(-32,     new byte[] {0xe0})]
		[TestCase(-33,     new byte[] {0xd0, 0xdf})]
		[TestCase(-128,    new byte[] {0xd0, 0x80})]
		[TestCase(-129,    new byte[] {0xd1, 0xff, 0x7f})]
		[TestCase(-0x8000, new byte[] {0xd1, 0x80, 0x00})]
		[TestCase(-0x8001, new byte[] {0xd2, 0xff, 0xff, 0x7f, 0xff})]
		public void PackIntValue(int value, byte[] expected)
		{
			var packer = new MiniMessagePacker ();
{'fraction_non_alphanumeric': 0.19346971955019646, 'fraction_numerical': 0.0773607912207018, 'mean_word_length': 3.7109125717932354, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4709283', 'n_tokens_mistral': 3463, 'n_tokens_neox': 2952, 'n_words': 755}