1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
/*
* Copyright (C) 2011.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 or
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
package func.files;
import java.io.File;
import java.io.IOException;
import uk.me.parabola.imgfmt.fs.DirectoryEntry;
import uk.me.parabola.imgfmt.fs.FileSystem;
import func.Base;
import func.lib.Args;
import func.lib.Outputs;
import func.lib.TestUtils;
import org.junit.Test;
import static org.junit.Assert.*;
public class IndexTest extends Base {
private static final String OVERVIEW_NAME = "testname";
private static final String MDR_IMG = OVERVIEW_NAME + "_mdr.img";
@Test
public void testCreateIndex() throws IOException {
File f = new File(MDR_IMG);
f.delete();
assertFalse("does not pre-exist", f.exists());
Outputs outputs = TestUtils.runAsProcess(
Args.TEST_STYLE_ARG,
"--index",
"--latin1",
"--family-id=1002",
"--overview-mapname=" + OVERVIEW_NAME,
Args.TEST_RESOURCE_IMG + "63240001.img",
Args.TEST_RESOURCE_IMG + "63240002.img"
);
outputs.checkError("Number of ExitExceptions: 0");
TestUtils.registerFile(MDR_IMG);
TestUtils.registerFile(OVERVIEW_NAME+".tdb");
TestUtils.registerFile(OVERVIEW_NAME+".mdx");
TestUtils.registerFile(OVERVIEW_NAME+".img");
assertTrue(MDR_IMG + " is created", f.exists());
FileSystem fs = openFs(MDR_IMG);
DirectoryEntry entry = fs.lookup(OVERVIEW_NAME.toUpperCase() + ".MDR");
assertNotNull("Contains the MDR file", entry);
entry = fs.lookup(OVERVIEW_NAME.toUpperCase() + ".SRT");
assertNotNull("contains the SRT file", entry);
fs.close();
}
}
|