Class FpExceptionGenerator
- java.lang.Object
-
- ru.ispras.testbase.knowledge.floating.FpExceptionGenerator
-
- All Implemented Interfaces:
Generator<FpNumber,FpException>
- Direct Known Subclasses:
FpAddExceptionGenerator
,FpSubExceptionGenerator
public abstract class FpExceptionGenerator extends java.lang.Object implements Generator<FpNumber,FpException>
FpExceptionGenerator
is a base interface for random generators targeted at the floating-point exceptions.
-
-
Constructor Summary
Constructors Constructor Description FpExceptionGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
check(FpException situation, FpNumber[] operands)
Checks the test data against the test situation.protected abstract boolean
checkInexact(FpNumber[] operands)
Checks whether the operation causes the inexact exception.protected abstract boolean
checkNormal(FpNumber[] operands)
Checks whether the operation does not cause exceptions.protected abstract boolean
checkOverflow(FpNumber[] operands)
Checks whether the operation causes the overflow exception.protected abstract boolean
checkUnderflow(FpNumber[] operands)
GeneratorResult<FpNumber>
generate(FpException situation, FpNumber[] operands)
Generates test data for the given test situation.protected abstract GeneratorResult<FpNumber>
generateInexact(FpNumber[] operands)
Tries to generate operands that cause the inexact exception.protected abstract GeneratorResult<FpNumber>
generateNormal(FpNumber[] operands)
Tries to generate operands that do not cause exceptions.protected abstract GeneratorResult<FpNumber>
generateOverflow(FpNumber[] operands)
Tries to generate operands that cause the overflow exception.protected abstract GeneratorResult<FpNumber>
generateUnderflow(FpNumber[] operands)
Tries to generate operands that cause the underflow exception.
-
-
-
Method Detail
-
check
public final boolean check(FpException situation, FpNumber[] operands)
Description copied from interface:Generator
Checks the test data against the test situation.- Specified by:
check
in interfaceGenerator<FpNumber,FpException>
- Parameters:
situation
- the test situation.operands
- the test data.- Returns:
true
if the test data correspond to the test situation;false
otherwise.
-
generate
public final GeneratorResult<FpNumber> generate(FpException situation, FpNumber[] operands)
Description copied from interface:Generator
Generates test data for the given test situation.- Specified by:
generate
in interfaceGenerator<FpNumber,FpException>
- Parameters:
situation
- the test situation.operands
- the test data having been fixed.- Returns:
- the test data.
-
checkNormal
protected abstract boolean checkNormal(FpNumber[] operands)
Checks whether the operation does not cause exceptions.- Parameters:
operands
- the operation operands.- Returns:
true
if the operation does not cause exceptions;false
otherwise.
-
generateNormal
protected abstract GeneratorResult<FpNumber> generateNormal(FpNumber[] operands)
Tries to generate operands that do not cause exceptions.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
checkOverflow
protected abstract boolean checkOverflow(FpNumber[] operands)
Checks whether the operation causes the overflow exception.- Parameters:
operands
- the operation operands.- Returns:
true
if the operation causes the exception;false
otherwise.
-
generateOverflow
protected abstract GeneratorResult<FpNumber> generateOverflow(FpNumber[] operands)
Tries to generate operands that cause the overflow exception.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
checkUnderflow
protected abstract boolean checkUnderflow(FpNumber[] operands)
-
generateUnderflow
protected abstract GeneratorResult<FpNumber> generateUnderflow(FpNumber[] operands)
Tries to generate operands that cause the underflow exception.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
checkInexact
protected abstract boolean checkInexact(FpNumber[] operands)
Checks whether the operation causes the inexact exception.- Parameters:
operands
- the operation operands.- Returns:
true
if the operation causes the exception;false
otherwise.
-
generateInexact
protected abstract GeneratorResult<FpNumber> generateInexact(FpNumber[] operands)
Tries to generate operands that cause the inexact exception.- Parameters:
operands
- the operation operands (operand[i] == null
if the i-th operation is not fixed; otherwiseoperand[i]
contains the operand value).- Returns:
- the operation operands.
-
-