Created
October 5, 2012 00:27
-
-
Save edipofederle/3837329 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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