/**
 * LOGICAL-PARADOX.ORG b-tree library
 * Copyright (C)2004 satoshi akabane(akabane@logical-paradox.org)
 *
 * Release 1.0
 * ・初期パージョン
 */
package org.logical_paradox.common.btree;

import junit.framework.TestCase;

/**
 * BtreeKeyのテスト用の実装のテスト<br>
 * @author satoshi akabane
 * @version 1.0
 */
public class BtreeKeyTestImplTest extends TestCase {

	/**
	 * Constructor for BtreeKeyTestImplTest.
	 * @param arg0
	 */
	public BtreeKeyTestImplTest(String arg0) {
		super(arg0);
	}

	public void testByteStream() throws Exception {
		BtreeKeyTestImpl key = new BtreeKeyTestImpl("あいうえお");
		byte[] bstream = key.byteStream();
		assertEquals(key.byteSize(), bstream.length);
		assertEquals(0, (int)bstream[10]);
		assertTrue(bstream[9] != 0);
	}
	public void testGetKeyFromBinaryStream() throws Exception {
		BtreeKeyTestImpl key1 = new BtreeKeyTestImpl("あいうえお");
		byte[] bstream = key1.byteStream();

		BtreeKeyTestImpl key2 = new BtreeKeyTestImpl(bstream);
		assertEquals(key1, key2);
	}
}
