use of org.evosuite.testcase.variable.ConstantValue in project evosuite by EvoSuite.
the class TestOverloading method testOverloadedConstructorBigFraction.
@Test
public void testOverloadedConstructorBigFraction() {
Class<?> clazz = BigFraction.class;
Constructor<?> constructor1 = clazz.getConstructors()[0];
Constructor<?> constructor2 = clazz.getConstructors()[1];
GenericConstructor genericConstructor1 = new GenericConstructor(constructor1, clazz);
GenericConstructor genericConstructor2 = new GenericConstructor(constructor2, clazz);
TestCase test = new DefaultTestCase();
ConstantValue longValue = new ConstantValue(test, long.class);
ConstantValue intValue = new ConstantValue(test, int.class);
List<VariableReference> parameters = Arrays.asList(longValue, intValue);
assertTrue(genericConstructor1.isOverloaded(parameters));
assertTrue(genericConstructor2.isOverloaded(parameters));
}
use of org.evosuite.testcase.variable.ConstantValue in project evosuite by EvoSuite.
the class ValueMinimizer method visitStatement.
@Override
public void visitStatement(Statement statement) {
for (VariableReference var : statement.getVariableReferences()) {
if (var instanceof ConstantValue) {
ConstantValue constantValue = (ConstantValue) var;
Object value = constantValue.getValue();
if (value instanceof String) {
logger.info("Statement before minimization: " + statement.getCode());
cleanString(constantValue);
removeCharacters(constantValue);
if (Properties.LM_STRINGS) {
replaceWithLanguageModel(constantValue);
}
logger.info("Statement after minimization: " + statement.getCode());
// TODO: Try to delete characters, or at least replace non-ascii characters with ascii characters
} else if (value instanceof Number) {
logger.info("Statement before minimization: " + statement.getCode());
binarySearch(constantValue, (Number) constantValue.getValue());
logger.info("Statement after minimization: " + statement.getCode());
}
}
}
}
Aggregations