/******************************************************************************* * Copyright (c) 2010 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.databoard.tests; import java.io.FileNotFoundException; import java.io.IOException; import junit.framework.TestCase; import org.simantics.databoard.util.binary.BinaryMemory; import org.simantics.databoard.util.binary.BinaryReadable; import org.simantics.databoard.util.binary.BinaryWriteable; import org.simantics.databoard.util.binary.RandomAccessBinary; import org.simantics.databoard.util.binary.RandomAccessBinary.ByteSide; public class TestBinaryMemory extends TestCase { public static final int ITERATIONS = 50; RandomAccessBinary file; public void setUp() throws Exception { file = new BinaryMemory(4096); } public void tearDown() throws Exception { file.close(); } public void testInsertRemove() throws IOException { // Write 4 MB file for (int i=0; i<1024*1024; i++) { file.writeInt(i ^0x53); } file.flush(); int iterCount = 16; long totInsertTime = 0; long totRemoveTime = 0; for (int iter=0; iter