codesnippets:testingconventions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| codesnippets:testingconventions [2022/04/06 13:35] – [QuickCheck] f2b216 | codesnippets:testingconventions [2025/10/08 00:48] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Testing conventions ====== | ====== Testing conventions ====== | ||
| - | ~~DISCUSSION~~ | ||
| ===== Setup with stack ===== | ===== Setup with stack ===== | ||
| Line 108: | Line 107: | ||
| === HUnit test === | === HUnit test === | ||
| + | |||
| + | * Function: HUnit.testCase | ||
| + | - parameter :: [Char]/ | ||
| + | * e.g. "Law A #u1", "Law A #u2", ... "Law A #u33" | ||
| + | - parameter :: Assertation: | ||
| + | * e.g. 3 * 2 @?= 2 * 3 | ||
| * example '' | * example '' | ||
| Line 118: | Line 123: | ||
| [ | [ | ||
| -- ..., | -- ..., | ||
| - | HU.testCase "#1" (A.f4 3 HU.@?= (A.f5 3 * A.f5 3)), | + | HU.testCase "#u1" (A.f4 3 HU.@?= (A.f5 3 * A.f5 3)), |
| - | HU.testCase "#2" (A.f4 4 HU.@?= (A.f5 4 * A.f5 4)) -- ... | + | HU.testCase "#u2" (A.f4 4 HU.@?= (A.f5 4 * A.f5 4)) -- ... |
| ] | ] | ||
| Line 126: | Line 131: | ||
| === QuickCheck test === | === QuickCheck test === | ||
| + | |||
| + | * Function: HUnit.testProperty | ||
| + | - parameter :: [Char]/ | ||
| + | * e.g. "Type 1 #p1", "Type 1 #p2", ... "Type 1 #p42" | ||
| + | - parameter :: a: Two functions from a lambda parameter left and rigth from " | ||
| + | * e.g. 3 * 2 @?= 2 * 3 | ||
| * example '' | * example '' | ||
| Line 136: | Line 147: | ||
| [ | [ | ||
| -- ..., | -- ..., | ||
| - | QC.testProperty "#1" (\nj -> A.f3 nj QC.==> (A.f4 nj == (A.f5 nj * A.f5 nj)) ), | + | QC.testProperty "#p1" (\nj -> A.f3 nj QC.==> (A.f4 nj == (A.f5 nj * A.f5 nj)) ), |
| - | QC.testProperty "#1" (\nj -> not A.f3 nj QC.==> (A.f4 nj == -1 ) -- ... | + | QC.testProperty "#p2" (\nj -> not A.f3 nj QC.==> (A.f4 nj == -1 ) -- ... |
| ] | ] | ||
| Line 227: | Line 238: | ||
| -- ... | -- ... | ||
| - | QC.testProperty " | + | QC.testProperty " |
| </ | </ | ||
| Line 255: | Line 266: | ||
| -- ... | -- ... | ||
| - | QC.testProperty "Char #1" (\cd' -> (fromT' | + | QC.testProperty "Char #p1" (\cd' -> (fromT' |
| </ | </ | ||
| Line 286: | Line 297: | ||
| * the complete set of possible test values/data is used in unit tests, | * the complete set of possible test values/data is used in unit tests, | ||
| * or values for all possible equivalence classes are used | * or values for all possible equivalence classes are used | ||
| - | * or ramdom | + | * or random |
| * independence: | * independence: | ||
| - | * test method is independent | + | * test methods are independent functions |
| - | * or dependent | + | * unless they depend |
| - | * boundaries: | + | * edge cases: |
| - | * corner | + | * edge cases are tested by unit tests (HUnit) |
| * conform doc.: | * conform doc.: | ||
| * all tests are conform to documentation, | * all tests are conform to documentation, | ||
| - | After checking the abovementioned | + | After checking the above mentioned |
| * < | * < | ||
| - | {- | + | {- * validated: ✅ |
| - | | + | |
| * completeness: | * completeness: | ||
| * independence: | * independence: | ||
| - | * boundaries | + | * edge cases : ✅ |
| * conform doc.: ✅ -} | * conform doc.: ✅ -} | ||
| tgUnitf1 :: T.TestTree | tgUnitf1 :: T.TestTree | ||
| Line 335: | Line 345: | ||
| After checking the abovementioned criteria, the result is documented as source code comment: | After checking the abovementioned criteria, the result is documented as source code comment: | ||
| * < | * < | ||
| - | {- | + | {- * validated: ✅ |
| - | | + | |
| * documented: ✅ | * documented: ✅ | ||
| * laws : ✅ | * laws : ✅ | ||
| Line 370: | Line 379: | ||
| Description : provides a class for ... | Description : provides a class for ... | ||
| Copyright | Copyright | ||
| - | License | + | License |
| Maintainer | Maintainer | ||
| Stability | Stability | ||
| Line 383: | Line 392: | ||
| * example: < | * example: < | ||
| - | {- module A | + | {- * validated: ✅ |
| - | | + | |
| * documented: ✅ | * documented: ✅ | ||
| * completeness: | * completeness: | ||
| Line 399: | Line 407: | ||
| </ | </ | ||
| + | |||
| + | ===== ✎ ===== | ||
| + | ~~DISCUSSION~~ | ||
codesnippets/testingconventions.1649244923.txt.gz · Last modified: (external edit)
