public void BinDumpBinaryStreams_TestUIntWrites()
		{
			uint[] values = new uint[] { 0, 1, 0x7F, 10, 0x7E, 32767, 32768, uint.MinValue, uint.MaxValue };

			using (MemoryStream ms_orig = new MemoryStream())
			{
				UndisposableStream ms = new UndisposableStream(ms_orig);

				using (BinDumpBinaryWriter bdbw = new BinDumpBinaryWriter(ms, Encoding.UTF8))
				{
					for (int i = 0; i < values.Length; i++)
					{
						bdbw.Write(values[i]);
					}
				}

				ms.Seek(0, SeekOrigin.Begin);

				using (BinDumpBinaryReader bdbr = new BinDumpBinaryReader(ms, Encoding.UTF8))
				{
					for (int i = 0; i < values.Length; i++)
					{
						uint v = bdbr.ReadUInt32();
						Assert.AreEqual(values[i], v, "i = " + i.ToString());
					}
				}
			}
		}
		internal int Undump(Stream stream, int sourceID, Table envTable, out bool hasUpvalues)
		{
			int baseAddress = m_RootChunk.Code.Count;
			SourceRef sourceRef = new SourceRef(sourceID, 0, 0, 0, 0, false);

			using (BinaryReader br = new BinDumpBinaryReader(stream, Encoding.UTF8))
			{
				ulong headerMark = br.ReadUInt64();

				if (headerMark != DUMP_CHUNK_MAGIC)
					throw new ArgumentException("Not a MoonSharp chunk");

				int version = br.ReadInt32();

				if (version != DUMP_CHUNK_VERSION)
					throw new ArgumentException("Invalid version");

				hasUpvalues = br.ReadBoolean();

				int len = br.ReadInt32();

				int numSymbs = br.ReadInt32();
				SymbolRef[] allSymbs = new SymbolRef[numSymbs];

				for (int i = 0; i < numSymbs; i++)
					allSymbs[i] = SymbolRef.ReadBinary(br);

				for (int i = 0; i < numSymbs; i++)
					allSymbs[i].ReadBinaryEnv(br, allSymbs);

				for (int i = 0; i <= len; i++)
				{
					Instruction I = Instruction.ReadBinary(sourceRef, br, baseAddress, envTable, allSymbs);
					m_RootChunk.Code.Add(I);
				}

				return baseAddress;
			}
		}
		public void BinDumpBinaryStreams_TestStringWrites()
		{
			string[] values = new string[] { "hello", "you", "fool", "hello", "I", "love", "you" };

			using (MemoryStream ms_orig = new MemoryStream())
			{
				UndisposableStream ms = new UndisposableStream(ms_orig);

				using (BinDumpBinaryWriter bdbw = new BinDumpBinaryWriter(ms, Encoding.UTF8))
				{
					for (int i = 0; i < values.Length; i++)
					{
						bdbw.Write(values[i]);
					}
				}

				ms.Seek(0, SeekOrigin.Begin);

				using (BinDumpBinaryReader bdbr = new BinDumpBinaryReader(ms, Encoding.UTF8))
				{
					for (int i = 0; i < values.Length; i++)
					{
						string v = bdbr.ReadString();
						Assert.AreEqual(values[i], v, "i = " + i.ToString());
					}
				}
			}
		}