Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created October 5, 2012 00:27
Show Gist options
  • Select an option

  • Save edipofederle/3837329 to your computer and use it in GitHub Desktop.

Select an option

Save edipofederle/3837329 to your computer and use it in GitHub Desktop.
// QuickCheck For Java Code Ideas
// haskell -> prop_test1 xs = not(null xs) ==> map(1*) ( square xs ) == map (\x -> x * x) xs
// Rascunho, provavelmente nada a ve :D
Property propTest = new Property();
propsTest.with(expectedFunction(), resultFunction("Test.functionToTest"), equals);
QuickCheck(propsTest(), forAllIntegers());
// Value é o valor gerado pelo QuickCheck
public Object expectedFunction(Object value){
return value + 1; // Aqui o que esperamos para cada valor ao ser aplicado a nossa funcao a ser testada(Test.functionToTest)
}
public Object resultFunction(Method methodToTest, Object value){
methodToTest(value);
}
class Test{
public Integer functionToTest(Integer value){
value + 1; // Muito Simples
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment