blob: 74693644c6f25124711f5869b1748e832f7db622 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011 Nokia and others.
* 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:
* Nokia - Initial API and implementation. Jun 29, 2011
*******************************************************************************/
package org.eclipse.cdt.debug.edc.tests;
import org.eclipse.cdt.debug.edc.internal.symbols.files.ExecutableSymbolicsReaderFactory;
import org.eclipse.core.runtime.IPath;
import org.junit.Test;
/**
* Run as Junit plugin test.
*/
public class TestExecutableSymbolicsReaderFactory extends BaseDwarfTestCase {
@Test
public void testReaderFactory() {
// This does nothing but for code coverage of the implicit constructor.
ExecutableSymbolicsReaderFactory factory = new ExecutableSymbolicsReaderFactory();
assertNotNull(factory);
/*
* The "bogus.exe" file has "bogus.sym" and "bogus.exe.sym" in the same
* folder. The function below should return the one with newer time
* stamp.
*/
IPath exeFile = getFile("bogus.exe");
IPath symCandidate1 = getFile("bogus.sym");
IPath symCandidate2 = getFile("bogus.exe.sym");
String expectedSym =
symCandidate1.toFile().lastModified() < symCandidate2.toFile().lastModified() ?
symCandidate2.lastSegment() : symCandidate1.lastSegment();
IPath symFound = ExecutableSymbolicsReaderFactory.findSymbolicsFile(exeFile);
assertEquals(expectedSym, symFound.lastSegment());
}
}