test_class.file: fuzzm/fuzzm/src/main/java/fuzzm/util/RatTest.java
test_class.identifier: RatTest
test_case.body: @Test
  	public void testRandomCoverage() {
  		try {
  
  			System.out.println("Testing random coverage" + "\n");
  
  			boolean stdOutput = true;
  			boolean fileOutput = false;
  
  			final int totalCount = 10000;
  			final NamedType nt = NamedType.INT;
  			final int minI = -128;
  			final int maxI = 127;		
  			final BigFraction min = new BigFraction(BigInteger.valueOf(minI));
  			final BigFraction max = new BigFraction(BigInteger.valueOf(maxI));
  
  			ArrayList<Integer> bias = new ArrayList<Integer>();
  			bias.add(-1);
  			bias.add(0);
  			bias.add(1);
  
  			int aBias;
  
  			ArrayList<Integer> missing = new ArrayList<Integer>();
  
  			for(int bIndex = 0; bIndex < bias.size(); bIndex++){
  
  				aBias = bias.get(bIndex);
  
  				if(stdOutput){
  					System.out.println("bias: " + aBias);
  				}
  
  				BufferedWriter myOut = null;
  
  				if(fileOutput){
  					String myFileName = buildOutputFilename("random_freq_", aBias, totalCount);
  					String rangeString = "_range_" + min + "--" + max;
  					String typeString = "_type-" + nt.toString();
  					myFileName = myFileName.concat(rangeString).concat(typeString).concat(".txt");
  
  					myOut = new BufferedWriter(new FileWriter(myFileName));
  					System.out.println(myFileName + "\n");
  				}
  
  				HashMap<Integer,Integer> hm = new HashMap<Integer, Integer>();
  
  				for(int i = 0; i < totalCount; i += 1){
  
  					BigFraction resBF = Rat.biasedRandom(nt, true, aBias, min, max);
  					double res = resBF.doubleValue();
  
  					if(hm.containsKey((int)res)){
  						Integer freq = hm.get((int)res);
  						freq = freq + 1;
  						hm.put((int)res, freq);
  					}
  					else
  					{
  						hm.put((int)res, 1);
  					}
  
  				} // end for totalCount
  
  				// output frequencies to file, one value per line.  format:  value, frequency 
  				if(fileOutput){
  					for(int i = minI; i <= maxI; i++){
  						if(hm.containsKey(i)){
  							int freq = hm.get(i);
  							myOut.write(i + ", " + freq + "\n");
  						}
  						else
  							myOut.write(i + ", " + 0 + "\n");
  
  					}
  				} // end if stdOutput
  
  				if(! (myOut==null)){
  					myOut.close();				
  				}
  
  				for(int i = minI; i <= maxI; i++){
  					if(! hm.containsKey(i))
  						missing.add(i);		
  				}
  
  				if(stdOutput){
  					System.out.println("missing count: " + missing.size());
  					System.out.println("missing: \n" + missing + "\n");
  				}
  
  				// test conditions:  Ensure we always produce min and max values.
  				Assert.assertFalse(missing.contains(minI));
  				Assert.assertFalse(missing.contains(maxI));
  
  				missing.clear();
  
  			} // end for bIndex
  		} catch (Throwable e) {
  			throw new Error(e);
  		}
  	}
test_case.class_method_signature: RatTest.testRandomCoverage()
test_case.full_signature: @Test public void testRandomCoverage()
test_case.identifier: testRandomCoverage
test_case.invocations: println valueOf valueOf add add add size get println buildOutputFilename toString concat concat concat println biasedRandom doubleValue containsKey get put put containsKey get write write close containsKey add println size println assertFalse contains assertFalse contains clear
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRandomCoverage()
focal_class.declarator: oracle = new Random()
focal_class.modifier: public static final
focal_class.original_string: public static final Random oracle = new Random();
focal_class.type: Random
focal_class.var_name: oracle
focal_class.file: fuzzm/fuzzm/src/main/java/fuzzm/util/Rat.java
focal_class.identifier: Rat
focal_class.class_method_signature: Rat.BigFractionFromString(String value)
focal_class.full_signature: public static BigFraction BigFractionFromString(String value)
focal_class.identifier: BigFractionFromString
focal_class.modifiers: public static
focal_class.parameters: (String value)
focal_class.return: BigFraction
focal_class.signature: BigFraction BigFractionFromString(String value)
focal_class.class_method_signature: Rat.TypeFromString(String type)
focal_class.full_signature: public static NamedType TypeFromString(String type)
focal_class.identifier: TypeFromString
focal_class.modifiers: public static
focal_class.parameters: (String type)
focal_class.return: NamedType
focal_class.signature: NamedType TypeFromString(String type)
focal_class.class_method_signature: Rat.ValueFromTypedFraction(NamedType ntype, BigFraction fvalue)
focal_class.full_signature: public static EvaluatableValue ValueFromTypedFraction(NamedType ntype, BigFraction fvalue)
focal_class.identifier: ValueFromTypedFraction
focal_class.modifiers: public static
focal_class.parameters: (NamedType ntype, BigFraction fvalue)
focal_class.return: EvaluatableValue
focal_class.signature: EvaluatableValue ValueFromTypedFraction(NamedType ntype, BigFraction fvalue)
focal_class.class_method_signature: Rat.ValueFromString(String type, String value)
focal_class.full_signature: public static EvaluatableValue ValueFromString(String type, String value)
focal_class.identifier: ValueFromString
focal_class.modifiers: public static
focal_class.parameters: (String type, String value)
focal_class.return: EvaluatableValue
focal_class.signature: EvaluatableValue ValueFromString(String type, String value)
focal_class.class_method_signature: Rat.toExpr(BigFraction x)
focal_class.full_signature: public static Expr toExpr(BigFraction x)
focal_class.identifier: toExpr
focal_class.modifiers: public static
focal_class.parameters: (BigFraction x)
focal_class.return: Expr
focal_class.signature: Expr toExpr(BigFraction x)
focal_class.class_method_signature: Rat.cast(String name, Type type)
focal_class.full_signature: public static Expr cast(String name, Type type)
focal_class.identifier: cast
focal_class.modifiers: public static
focal_class.parameters: (String name, Type type)
focal_class.return: Expr
focal_class.signature: Expr cast(String name, Type type)
focal_class.class_method_signature: Rat.pubBias(double rnd, int bias)
focal_class.full_signature: protected static double pubBias(double rnd, int bias)
focal_class.identifier: pubBias
focal_class.modifiers: protected static
focal_class.parameters: (double rnd, int bias)
focal_class.return: double
focal_class.signature: double pubBias(double rnd, int bias)
focal_class.class_method_signature: Rat.bias(double rnd, int bias)
focal_class.full_signature: private static double bias(double rnd, int bias)
focal_class.identifier: bias
focal_class.modifiers: private static
focal_class.parameters: (double rnd, int bias)
focal_class.return: double
focal_class.signature: double bias(double rnd, int bias)
focal_class.class_method_signature: Rat.biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.full_signature: private static BigFraction biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.identifier: biasedRandom
focal_class.modifiers: private static
focal_class.parameters: (boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.return: BigFraction
focal_class.signature: BigFraction biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.class_method_signature: Rat.biasedRandom(Type type, boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.full_signature: public static BigFraction biasedRandom(Type type, boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.identifier: biasedRandom
focal_class.modifiers: public static
focal_class.parameters: (Type type, boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.return: BigFraction
focal_class.signature: BigFraction biasedRandom(Type type, boolean biased, int bias, BigFraction min, BigFraction max)
focal_class.class_method_signature: Rat.roundDown(BigFraction max)
focal_class.full_signature: public static BigFraction roundDown(BigFraction max)
focal_class.identifier: roundDown
focal_class.modifiers: public static
focal_class.parameters: (BigFraction max)
focal_class.return: BigFraction
focal_class.signature: BigFraction roundDown(BigFraction max)
focal_class.class_method_signature: Rat.roundUp(BigFraction min)
focal_class.full_signature: public static BigFraction roundUp(BigFraction min)
focal_class.identifier: roundUp
focal_class.modifiers: public static
focal_class.parameters: (BigFraction min)
focal_class.return: BigFraction
focal_class.signature: BigFraction roundUp(BigFraction min)
focal_method.body: private static BigFraction biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max) {
  		double drnd = biased ? bias(oracle.nextDouble(),bias) : oracle.nextDouble();
  		BigDecimal rnd = BigDecimal.valueOf(drnd);
  		BigFraction r = BigFraction.valueOf(rnd);
  		BigFraction offset = (max.subtract(min)).multiply(r);
  		BigFraction res = min.add(offset);
  		return res;
  	}
focal_method.class_method_signature: Rat.biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)
focal_method.full_signature: private static BigFraction biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)
focal_method.identifier: biasedRandom
focal_method.invocations: bias nextDouble nextDouble valueOf valueOf multiply subtract add
focal_method.modifiers: private static
focal_method.parameters: (boolean biased, int bias, BigFraction min, BigFraction max)
focal_method.return: BigFraction
focal_method.signature: BigFraction biasedRandom(boolean biased, int bias, BigFraction min, BigFraction max)