codesnippets:codingconventions
Differences
This shows you the differences between two versions of the page.
| codesnippets:codingconventions [2024/06/02 22:05] – [Outline of a module] f2b216 | codesnippets:codingconventions [2025/10/08 00:48] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 244: | Line 244: | ||
| * description ('' | * description ('' | ||
| * in way that it becomes a complete sentence when started with module name | * in way that it becomes a complete sentence when started with module name | ||
| - | * like in the code below it translates to '' | + | * like in the code below it translates to '' |
| - | * copright | + | * copyright |
| * license | * license | ||
| * All rights reserved | * All rights reserved | ||
| Line 261: | Line 261: | ||
| * bullets | * bullets | ||
| * most important properties | * most important properties | ||
| - | | + | |
| - | * output of example | + | * may be with output of example |
| + | * ideally using doc test | ||
| + | * example: < | ||
| + | -- >>> | ||
| + | -- 120 | ||
| + | </ | ||
| * Example: <code Haskell> | * Example: <code Haskell> | ||
| {-| | {-| | ||
| - | Description : is to print to a line oriented output devices (e.g. stdout), in a pretty formatted way. | + | Description : makes it easier |
| Copyright | Copyright | ||
| License | License | ||
| Line 273: | Line 278: | ||
| Portability : POSIX | Portability : POSIX | ||
| - | * supports formatting by the following type class: | + | * makes it easier to export functional tests that are not exported themselves. |
| - | | + | * suggested prefix: __/Exp/__ |
| - | | + | * See also module HPowerLib.ImportTests, |
| - | * implements the following instances of type classes Formatting: | + | ==== __Example code to export tests__ |
| - | * ' | ||
| - | |||
| - | * example | ||
| @ | @ | ||
| - | module Main where | + | ... |
| - | import qualified DataStruct as Dt | + | module HPowerLib.Parser |
| - | import qualified PrettyLines as PrtLns (Formatting(..)) | + | ( |
| - | + | ... | |
| - | main :: IO () | + | , ... |
| - | main = do | + | , testGroup_parseComposable |
| - | PrtLns.print $ myTree | + | |
| - | + | ||
| - | data Symbol = A | B | C | + | |
| - | | + | |
| ... | ... | ||
| @ | @ | ||
| - | |||
| - | * creates the following output to stdout | ||
| - | |||
| - | @ | ||
| - | Ah | ||
| - | +-Ah | ||
| - | +-Beh | ||
| - | | +-Ah | ||
| - | | +-Beh | ||
| - | | +-Ceh | ||
| - | +-Ceh | ||
| - | +-Ah | ||
| - | @ | ||
| - | |||
| -} | -} | ||
| </ | </ | ||
| Line 461: | Line 446: | ||
| * example: <code Haskell> | * example: <code Haskell> | ||
| - | class Show d => Format d where | + | -- HUnit |
| - | {- | | + | -- | ...capability to compare the expected value with the actual one, |
| - | * formated in a human readable pretty way, when printed to a text file or stream like _stdout_. | + | -- | and to display the difference if there is one. |
| + | {-| | ||
| + | -} | ||
| + | class ( Show cmp ) => HUnit cmp where | ||
| + | -- equals | ||
| + | {- | ...compares the expected value with the actual one. | ||
| + | * result ' | ||
| -} | -} | ||
| - | | + | |
| - | -- | data to be formated in a pretty way | + | |
| - | :: d | + | |
| - | -- | formatted string representing the data | + | -> Bool -- ^ ' |
| - | -> String | + | |
| </ | </ | ||
| Line 650: | Line 641: | ||
| </ | </ | ||
| - | ===== // // | + | |
| + | ===== ✎ ===== | ||
| ~~DISCUSSION~~ | ~~DISCUSSION~~ | ||
codesnippets/codingconventions.1717358722.txt.gz · Last modified: (external edit)
