├── .gitignore ├── COBOLUnitDoc ├── CBUFeatures.wiki ├── RoutDet.wiki ├── StructureTests.png ├── Tutorial.wiki └── legacy.png ├── COBOLUnitLib ├── CBU00000.cob ├── CBU00001.cob ├── CBU00002.cob ├── CBU00003.cob ├── CBU00004.cob ├── CBU00005.cob ├── CBU00006.cob ├── CBU00007.cob ├── CBU00008.cob ├── CBU00009.cob ├── CBU00011.cob ├── CBU00012.cob ├── CBU00020.cob ├── CBU00025.cob ├── CBU00030.cob ├── CBU00040.cob ├── CBU00050.cob ├── CBU00060.cob ├── CBU00080.cob ├── CBU00100.cob ├── CBU00101.cob ├── CBU00102.cob ├── CBU00103.cob ├── CBU00200.cob ├── CBU00300.cob ├── CBU00301.cob ├── CBU0U001.cob ├── COPY │ ├── CBUC0001.cob │ └── CBUC0002.cob ├── COPYING.txt └── Makefile ├── COBOLUnitSamples ├── Makefile ├── Sample1 │ ├── COPY │ │ └── SAMPC001.cob │ ├── Makefile │ ├── SAMPLE01.cob │ ├── SUITE001.cob │ └── TS000001.cob ├── Sample2 │ ├── COPY │ │ └── SAMPC002.cob │ ├── Makefile │ ├── SAMPLE02.cob │ ├── SUITE002.cob │ └── TS000002.cob └── Sample3 │ ├── COPY │ └── SAMPC003.cob │ ├── Makefile │ ├── SAMPLE03.cob │ ├── SUITE003.cob │ └── TS000003.cob ├── COBOLUnitTests ├── COPY │ └── CTUC0001.cob ├── CTU000S1.cob ├── CTU0S1T1.cob ├── CTU0S1T2.cob ├── CTU0S2T1.cob ├── CTU0S3T1.cob ├── CTU0S3T2.cob └── Makefile ├── LICENSE ├── Makefile └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.swp 3 | 4 | # Ouput files 5 | *.o 6 | *.dylib 7 | */tests/* 8 | 9 | # Eclipse 10 | .buildpath 11 | .project 12 | .settings 13 | -------------------------------------------------------------------------------- /COBOLUnitDoc/CBUFeatures.wiki: -------------------------------------------------------------------------------- 1 | #summary COBOLUnit Features implemented and to implement 2 | 3 | = COBOLUnit Features = 4 | 5 | == Definition == 6 | 7 | The following figure presents tests structuration for COBOLUnit: 8 | 9 | 10 | 11 | == Implemented == 12 | 13 | * Two assertions types could be used: 14 | * Equals for string 15 | * Equals for numeric format 16 | * Declaration of a test which include assertions. 17 | * Declaration a tests suite including declared tests 18 | * Declaration of a suites tests case including declared suites 19 | * Add an assertion to a test 20 | * Add a test to a specific suite 21 | * Add a suite to the tests suites case 22 | * Run the global suites tests case 23 | * Run a specific test suites 24 | * Display log results 25 | 26 | == To follow == 27 | 28 | * Create a log file with the log result 29 | * Adding a user suite context for each suite to enable its use during tests 30 | * Add 'SetUp' and 'Teardown' routines for suites to setup and teardown suite context 31 | * Code generation for the tests suites Case from a flat file 32 | * Adding new assert types (notEquals, greaterThan, LesserThan,...) 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /COBOLUnitDoc/RoutDet.wiki: -------------------------------------------------------------------------------- 1 | #summary Routines details 2 | 3 | #sidebar TableOfContent 4 | Description of COBOLUnit routines 5 | 6 | 7 | = Introduction = 8 | * All COBOLUnit routines are referenced in the copy book CBU-func. 9 | * This copy book contains mapping between the physical routine name and its logical name 10 | 11 | 12 | = Details = 13 | 14 | 15 | 18 | 21 | 24 | 27 | 30 | 31 | 32 | 33 | 34 | 37 | 40 | 43 | 44 | 45 | 46 | 47 | 50 | 53 | 56 | 57 | 58 | 59 | 60 | 65 | 68 | 71 | 72 | 73 | 74 | 75 | 78 | 81 | 84 | 85 | 86 | 87 | 88 | 95 | 98 | 101 | 102 | 103 | 104 | 105 | 114 | 117 | 122 | 123 | 124 | 125 | 126 | 129 | 132 | 135 | 136 | 137 | 138 | 139 | 144 | 147 | 150 | 151 | 152 | 153 | 154 | 157 | 160 | 163 | 164 | 165 | 166 | 167 | 172 | 175 | 178 | 179 | 180 | 181 | 188 | 191 | 194 | 195 | 196 | 197 | 198 | 203 | 206 | 209 | 210 | 211 | 212 | 213 | 218 | 221 | 224 | 225 | 226 | 227 | 228 | 229 | 234 | 237 | 240 | 241 | 242 | 243 | 244 | 247 | 250 | 253 | 254 | 255 | 256 | 257 | 263 | 266 | 269 | 270 | 271 | 272 | 273 | 274 | 283 | 286 | 289 | 290 | 291 | 292 | 293 | 298 | 301 | 304 | 305 | 306 | 307 | 308 | 315 | 318 | 321 | 322 | 323 | 324 | 325 | 332 | 335 | 338 | 339 | 340 | 341 | 342 | 349 | 352 | 355 | 356 |
16 | Logical routine name 17 | 19 | Physical routine name 20 | 22 | Inputs 23 | 25 | Outputs 26 | 28 | Description 29 |
CBU-reset-run CBU-0000 35 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 36 |
    38 |
  • CBU-ctx
  • 39 |
    41 | Reset all COBUnit variables between each suite test run 42 |
    CBU-initialize CBU-0001 48 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 49 |
    51 |
  • CBU-ctx
  • 52 |
    54 | Resel all COBOLUnit variables for using COBOLUnit framework, this routine should be the first called when using COBOLUnit 55 |
    CBU-call-test CBU-0002 61 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 62 | 63 |
  • Test-name X(20): test name that COBOLUnit should run
  • 64 |
    66 |
  • CBU-ctx
  • 67 |
    69 | Call the COBOL program given in parameter "Test-name" 70 |
    CBU-run CBU-0003 76 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 77 |
    79 |
  • CBU-ctx
  • 80 |
    82 | Run all tests suites that have been added in COBOLUnit using routines "CBU-add-suite" and "CBU-add-test" or "CBU-add-test-next" 83 |
    CBU-add-suite CBU-0004 89 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 90 | 91 |
  • Suite-name X(20): Suite name to add
  • 92 | 93 |
  • Suite-description X(100): Description/Comment of the suite to add
  • 94 |
    96 |
  • CBU-ctx
  • 97 |
    99 | Add a suite to the COBOLUnit engine with the given parameters 100 |
    CBU-add-test CBU-0005 106 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 107 | 108 |
  • Suite-id 9(2): Suite index in which added test
  • 109 | 110 |
  • Test-name X(20): Test name to add
  • 111 | 112 |
  • Test-description X(100): Description/Comment of the test to add
  • 113 |
    115 |
  • CBU-ctx
  • 116 |
    118 | Add a test to the suite given in parameter using "Test-name" and "Test-description". (The test name is the name of the program cobol which contains assertions). 119 | See the tutorial section for more information. 120 | If you add tests consecutively you could choose "CBU-add-test-next" 121 |
    CBU-suites-run CBU-0006 127 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 128 |
    130 |
  • CBU-ctx
  • 131 |
    133 | Run all suites tests added in "CBU-ctx". 134 |
    CBU-suite-run CBU-0007 140 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 141 | 142 |
  • Suite-id 9(2): Suite index of the suite you want to run tests
  • 143 |
    145 |
  • CBU-ctx
  • 146 |
    148 | Run all the tests added to the suite which index is "Suite-id" (given in parameter) 149 |
    CBU-tests-run CBU-0008 155 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 156 |
    158 |
  • CBU-ctx
  • 159 |
    161 | Run all the tests added to the suite which index is contained in "index-current-suite" from CBU-ctx 162 |
    CBU-test-run CBU-0009 168 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 169 | 170 |
  • Test-id 9(2): Test index of the test you want to run
  • 171 |
    173 |
  • CBU-ctx
  • 174 |
    176 | Run the test which index is "Test-id" (given in parameter) 177 |
    CBU-add-test-next CBU-0012 182 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 183 | 184 |
  • Test-name X(20): Test name to add
  • 185 | 186 |
  • Test-description X(100): Description/Comment test to add
  • 187 |
    189 |
  • CBU-ctx
  • 190 |
    192 | Add a test to the current suite. Current suite index is set in "index-current-suite" from "CBU-ctx" 193 |
    CBU-add-assert-succeed CBU-0020 199 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 200 | 201 |
  • Assert-name X(20): Assert name which succeed (not use for the moment)
  • 202 |
    204 |
  • CBU-ctx
  • 205 |
    207 | Increment by one the assert success for the considered suite (index-current-suite from CBU-copy) 208 |
    CBU-add-assert-run CBU-0025 214 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 215 | 216 |
  • Assert-name X(20): Assert name which succeed (not use for the moment)
  • 217 |
    219 |
  • CBU-ctx
  • 220 |
    222 | Increment by one the asserts run for the considered suite (index-current-suite from CBU-copy) 223 |
    CBU-add-assert-failed CBU-0030 230 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 231 | 232 |
  • Assert-name X(20): Assert name which succeed (not use for the moment)
  • 233 |
    235 |
  • CBU-ctx
  • 236 |
    238 | Increment by one the asserts failed for the considered suite (index-current-suite from CBU-copy) 239 |
    CBU-add-error CBU-0040 245 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 246 |
    248 |
  • CBU-ctx
  • 249 |
    251 | Increment by one the errors numbers for the considered suite (index-current-suite from CBU-copy. (An error occurs when the test name does not match with a COBOL program. 252 |
    CBU-log-assert-succeed CBU-0050 258 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 259 | 260 |
  • Assert-name: Assertion name which succeed
  • 261 | 262 |
    264 |
  • CBU-ctx
  • 265 |
    267 | This routine is called each tima an assert succeed to log information 268 |
    CBU-log-assert-failed CBU-0060 275 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 276 | 277 |
  • Assert-name: Assertion name which succeed
  • 278 | 279 |
  • Expected-result X(32000): Expected result for the assert
  • 280 | 281 |
  • Actual-result X(32000): Actual result once this assert ran
  • 282 |
    284 |
  • CBU-ctx
  • 285 |
    287 | This routine is called each tima an assert failed to log information 288 |
    CBU-write-log-line CBU-0080 294 |
  • CBU-ctx: CBU context variables providing in copy book "CBU-copy"
  • 295 | 296 |
  • Log-line X(255): Line to Log
  • 297 |
    299 | none 300 | 302 | Log the line given in parameter. 303 |
    CBU-assert-str(100)-equals CBU-0100 309 |
  • Assert-name: Assertion name
  • 310 | 311 |
  • Expected-result X(100): Expected result for the assert
  • 312 | 313 |
  • Actual-result X(100): string to compare
  • 314 |
    316 |
  • CBU-ctx
  • 317 |
    319 | Assertion succeed if "Actual-result" equals "Expected-result" otherwise assertion failed 320 |
    CBU-assert-str-equals CBU-0101 326 |
  • Assert-name: Assertion name
  • 327 | 328 |
  • Expected-result X(32000): Expected result for the assert
  • 329 | 330 |
  • Actual-result X(32000): string to compare
  • 331 |
    333 |
  • CBU-ctx
  • 334 |
    336 | Assertion succeed if "Actual-result" equals "Expected-result" otherwise assertion failed 337 |
    CBU-assert-nb3-equals CBU-0102 343 |
  • Assert-name: Assertion name which succeed
  • 344 | 345 |
  • Expected-nb 9(3): Expected result for the assert
  • 346 | 347 |
  • Actual-nb 9(3): number to compare
  • 348 |
    350 |
  • CBU-ctx
  • 351 |
    353 | Assertion succeed if "Actual-result" equals "Expected-result" otherwise assertion failed 354 |
    357 | -------------------------------------------------------------------------------- /COBOLUnitDoc/StructureTests.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gbeine/COBOLUnit/4ef4ed3f57c6e9fc52233cbe623feb679f60d1f8/COBOLUnitDoc/StructureTests.png -------------------------------------------------------------------------------- /COBOLUnitDoc/Tutorial.wiki: -------------------------------------------------------------------------------- 1 | #summary COBOLUnit tutorial. 2 | #sidebar TableOfContent 3 | 4 | 5 |
    6 | Table of contents 7 | 8 | 9 | = Introduction = 10 | In this section, we're going to use *COBOLUnit* trough a simple example. 11 | 12 | 13 | = Prerequisites = 14 | * You like to read stories! 15 | * You can develop in COBOL 16 | * All sources can be found in source section 17 | 18 | 19 | = Contract of this section? = 20 | The aim of this page is to learn the reader how to use the COBOLUnit framework. 21 |

    At the end of this section you should: 22 | * Have coded three COBOLUnit suites 23 | * Have coded the associated tests 24 | * Be able to automatically run these tests. 25 | 26 | 27 | = Before, let me tell you a story = 28 | Once upon a time... No No! Just imagine...

    29 | You've just arrived in an organization with a lot of legacy code inherited from the past.

    30 | *But*: 31 | * You don't understand it (complex with no comment), 32 | * The documentation is out of date, 33 | * The routines goals are not clear 34 | * All the developers who have contributed have left 35 | 36 | *So You do not dare to move the code because you don't control impact on others modules* 37 | 38 | 39 | ^(If you tell me that you have never encountered this situation^

    40 | ^then you have a lot of chance, or you write new code independently^

    41 | ^or you are not totally honest!)^ 42 | 43 | Your boss ask you for a modification. 44 |
    Luckily, a fantastic tool give you the linkage between all the routines!
    45 | 46 |

    47 | Now you have two choice: 48 | * Duplicate code to ensure no regression (this is what did your predecessors) 49 | * Using COBOLUnit to *document* existing routines and to quickly track errors introduced by new code. 50 | 51 | == Here is our legacy code == 52 | Our legacy code is made of 3 routines: 53 | * Sample1.cob 54 | * Sample2.cob: it uses Sample1 55 | * Sample3.cob: it uses Sample1 and Sample2 56 | 57 | These Three routines are maintained by *different teams*. 58 |

    The modification wanted should be done on *Sample1.cob*. 59 | 60 | The only things you know is: 61 | 62 | * Sample1 is always called with the values (3,2) and returns 1 63 | * Sample2 is always called with the values (5,2,5) and returns 5 64 | * Sample3 is always called with the values (2,2,2,5) and returns 7 65 | 66 | Why is this code used for? Ask people in the past becaus i dont know!

    67 | Actually "Sample2" and "Sample3" are black boxes.

    68 | Your mission is to modify the *Sample1* code with no regression.

    69 |

    70 | *Right now*, *Sample1's* contract is: 71 |
    *to guarantee same results when *Sample2* and *Sample3* call it.*
    72 | 73 | Because you do not want to crash the production system (no regression), 74 | you decided to realize tests to safeguard the actual behavior. 75 |

    Then you should be more confident to make the modification asked. 76 |

    77 | 78 | Let's take *Sample1* and write test on it. 79 | The test is simple:

    80 | _to check *Sample1* call with params (3,2) returns 1!!_ 81 |

    82 | So we have to write a suite including only one test. 83 | 84 |

    85 | = Let's write our first tests suite in COBOLUnit = 86 | *_First of all, COBOLUnit is not intrusive.

    87 | So you will be able to develop tests on the three modules without modifying the source code._* 88 | 89 | == Sample1 tests == 90 | 91 | * *Create* a COBOL source code called TS-SUITE.cob.

    92 | It should include our suite(s) and test(s) declarations.

    93 | This source will be call to run tests. 94 | * *Insert* COBOLUnit copy books: "CBU-func" and "CBU-copy". 95 | * CBU-func.copy: contains logical routines names and mapping with physical routines names. 96 | * CBU-copy: contains the main COBOLUnit picture (-CBU-ctx-) which maintains COBOLUnit context variables (This picture will be passed to all COBOLUnit routines). 97 | *CT-SUITE.cob:* 98 | 99 | {{{ 100 | WORKING-STORAGE SECTION. 101 | COPY CBU-func. 102 | COPY CBU-copy. 103 | }}} 104 | 105 | * *Initialize* the COBOLUnit engine (to setup COBOLUnit context), for this we call the routine: *CBU-initialize* with the _CBU-ctx_ in argument. 106 | 107 | {{{ 108 | CALL CBU-initialize USING CBU-ctx 109 | }}} 110 | 111 | * *Declare* your suite and tests.To do this, use: *CBU-add-suite* and *CBU-add-test-next* routines. 112 | * *CBU-add-suite* *USING* *[_CBU-ctx, suite-name, suite-description_]*: declare a suite with a name and a description. But remember, you also have to give COBOLUnit context (CBU-ctx). The signature of the service is: 113 | *CBU-ctx: providing in the copy book CBU-copy 114 | *suite-name: PIX(20) 115 | *suite-description: PICX(100) 116 | * *CBU-add-test-next* *USING* *[_CBU-ctx, test-name, test-description_]*: add a test in the suite just added and just after the precedent test (next!). The signature of the service is: 117 | *CBU-ctx: providing in the copy book CBU-copy 118 | *test-name: PIX(20) 119 | *test-description: PICX(100) 120 | {{{ 121 | CALL CBU-add-suite USING CBU-ctx str1 str2. 122 | }}} 123 | 124 | * *Run* the suite tests using: *CBU-run*. 125 | 126 | {{{ 127 | CALL CBU-run USING CBU-ct 128 | }}} 129 | 130 | Your routine should now looks like: 131 | 132 | *TS-SUITE.cob:* 133 | {{{ 134 | IDENTIFICATION DIVISION. 135 | PROGRAM-ID. TS-SUITE. 136 | ENVIRONMENT DIVISION. 137 | CONFIGURATION SECTION. 138 | DATA DIVISION. 139 | WORKING-STORAGE SECTION. 140 | COPY CBU-func. 141 | 01 str1 PIC X(20). 142 | 01 str2 PIC X(100). 143 | 01 RES PIC 99. 144 | COPY CBU-copy. 145 | PROCEDURE DIVISION. 146 | INITIALIZE str1 str2. 147 | MOVE "SUITE1" TO str1. 148 | MOVE "DESC SUITE1" TO str2. 149 | CALL CBU-initialize USING CBU-ctx. 150 | CALL CBU-add-suite USING CBU-ctx str1 str2. 151 | 152 | INITIALIZE str1 str2. 153 | MOVE "TS1" TO str1. 154 | MOVE "TEST1 desc" TO str2. 155 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 156 | 157 | INITIALIZE str1 str2. 158 | MOVE "TS2" TO str1. 159 | MOVE "TEST2 desc" TO str2. 160 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 161 | 162 | INITIALIZE str1 str2. 163 | MOVE "TS3" TO str1. 164 | MOVE "TEST3 desc" TO str2. 165 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 166 | 167 | CALL CBU-run USING CBU-ctx. 168 | END PROGRAM TS-SUITE. 169 | }}} 170 | 171 | That's it, we've done it: our first COBOLUnit Suite! 172 | And now let's compile the code 173 | Because i do not have mainframe at home i use [http://www.opencobol.org/ OpenCOBOL] compiler. 174 | 175 | === How to compile with openCOBOL? === 176 | To perform this task, i decided to write shell scripts and Makefile. 177 | For further explaination you can go to [http://www.opencobol.org/ OpenCOBOL site]. 178 | * "env.script:" this file setup environment variables (use it with _source_ command). 179 | * *Makefile:* this script contains rules for compilation. 180 | * *build.sh:" this criptt calls Makefile 181 | * *test.sh:* launch Suite tests 182 | 183 | You will find above my scripts: 184 | 185 | 186 | 189 | 192 | 193 | 194 | 208 | 231 | 232 |
    > 187 | env.script 188 | > 190 | Makefile 191 |
    > 195 | {{{ 196 | # Set the COBOLUnit PATH 197 | export CBU_PATH=/home/hva/workspace/COBOLUnit 198 | # Set the Sample1_path 199 | export SAMPLE1_PATH=/home/hva/workspace/Sample1 200 | export SAMPLE1_TEST_LIB_PATH=$SAMPLE1_PATH/tests/lib 201 | export SAMPLE1_LIB_PATH=$SAMPLE1_PATH/lib 202 | 203 | export CBU_LIB_PATH=$CBU_PATH/lib 204 | export LD_LIBRARY_PATH=$CBU_LIB_PATH: 205 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SAMPLE1_TEST_LIB_PATH:$SAMPLE1_LIB_PATH 206 | }}} 207 | > 209 | {{{ 210 | all: Sample1 TS-SUITE 211 | 212 | Sample1: Sample1.cob 213 | cobc -m -o libSample1 Sample1.cob 214 | mv libSample1.so lib/ 215 | 216 | 217 | TS-SUITE: TS-SUITE.cob 218 | cobc -x -I $(CBU_PATH) TS-SUITE.cob -L $(CBU_LIB_PATH) -l COBOLUnit 219 | mv ./TS-SUITE tests/ 220 | 221 | clean: 222 | rm -rf *.so 223 | rm -rf lib/ 224 | rm -rf tests/ 225 | mkdir lib/ 226 | mkdir tests/ 227 | mkdir tests/lib/ 228 | 229 | }}} 230 |
    233 | 234 | 235 | 236 | 239 | 242 | 243 | 244 | 259 | 269 | 270 |
    > 237 | build.sh* 238 | > 240 | test.sh* 241 |
    > 245 | {{{ 246 | #!/bin/bash 247 | 248 | rm -rf *.so 249 | rm -rf lib/ 250 | rm -rf tests/ 251 | mkdir lib/ 252 | mkdir tests/ 253 | mkdir tests/lib/ 254 | 255 | make all 256 | exit 0; 257 | }}} 258 | > 260 | {{{ 261 | #!/bin/bash 262 | 263 | #lib/tests/CBU-test-suite 264 | tests/./TS-SUITE 265 | 266 | exit 0; 267 | }}} 268 |
    271 | 272 | To compile we only have to type: 273 | 274 | 278 | 292 | 293 |
    275 |
    *$ source env.script*
    276 |
    *$ ./build.sh*
    277 |
    279 | _result screen:_ 280 | 281 | {{{ 282 | cobc -m -o libSample1 Sample1.cob 283 | Sample1.cob:17: Warning: File not terminated by a newline 284 | mv libSample1.so lib/ 285 | cobc -x -I (COBOLUnit_PATH) T-SUITE.cob -L (COBOLUnit_PATH)/lib -l COBOLUnit 286 | /CBU-copy.cob:68: Warning: File not terminated by a newline 287 | /CBU-func.cob:55: Warning: File not terminated by a newline 288 | TS-SUITE.cob:25: Warning: File not terminated by a newline 289 | mv ./TS-SUITE tests/ 290 | }}} 291 |
    294 | 295 | Once compilation is made, run the suite: 296 | 297 | 298 | 299 | 302 | 325 | 326 |
    300 |
    *$ ./test.sh*
    301 |
    303 | {{{ 304 | _result screen:_ 305 | 306 | 307 | $ ./test.sh 308 | 309 | 310 | 311 | |--- SUITE1 312 | | Test 'TS1' is * FAILURE * (000 Assertions, 000 Failures. 001 errors) 313 | |--- FAILURE 314 | 315 | 316 | ******************************************************************** 317 | * FAILURE * 318 | * (001 test cases, 000 success, 000 failures, 001 errors) * 319 | ******************************************************************** 320 | (00 min:00 sec:01 ms) 321 | hva@octo-hva:~/workspace/Sample1$ 322 | }}} 323 | 324 |
    327 | 328 | The output sreen indicates that the suites test have failed: 329 | 330 | {{{ 331 | ******************************************************************** 332 | * FAILURE * 333 | * (001 test cases, 000 success, 000 failures, 001 errors) * 334 | ******************************************************************** 335 | }}} 336 | 337 | 338 | * Above COBOLUnit gave us information: 339 | * CBU has launch *SUITE1* Suite (we could have more than only one suite!): 340 | * CBU contained one test 'TS1' tha has be ran and which failed in error: 341 | 342 | {{{ 343 | |--- SUITE1 344 | | Test 'TS1' is * FAILURE * (000 Assertions, 000 Failures. 001 errors) 345 | |--- FAILURE 346 | }}} 347 | 348 | 349 | Actually We have one error, because we *DO NOT HAVE YET IMPLEMENTED our test!!!* 350 | 351 | === A suite without test it's good but with tests it's better === 352 | In this section we are going to see how to implement a very simple test. 353 | 354 | * *Create* COBOL source code with the same name than your test declaration: *TS1* 355 | * *Insert* COBOLUnit copy books *CBU-copy* and *CBU-func*. 356 | The *CBU-copy* copy books should be declared in LINKAGE SECTION. 357 | 358 | {{{ 359 | WORKING-STORAGE SECTION. 360 | COPY CBU-func. 361 | LINKAGE SECTION. 362 | COPY CBU-copy. 363 | }}} 364 | 365 | * *Implement* your test using assertion routines. 366 | * As i told you, the only thing i know (that is a fact!) is when i call Sample1 routine with parameters "3" and "2" it returns "1". 367 | * So in our test we have to call *Sample1* using "3" and "2" and check that the result is "1". 368 | * To do that we implement the test (and so the correct assertion) as follow: 369 | 370 | *TS1.cob" 371 | {{{ 372 | IDENTIFICATION DIVISION. 373 | PROGRAM-ID. TS1. 374 | ENVIRONMENT DIVISION. 375 | CONFIGURATION SECTION. 376 | DATA DIVISION. 377 | WORKING-STORAGE SECTION. 378 | COPY CBU-func. 379 | 01 A PIC 99. 380 | 01 B PIC 99. 381 | 01 RES PIC 99. 382 | 01 EXPECTED PIC 99. 383 | 01 assert-name PIC X(20). 384 | LINKAGE SECTION. 385 | COPY CBU-copy. 386 | PROCEDURE DIVISION USING CBU-ctx. 387 | MOVE 1 TO EXPECTED. 388 | MOVE 3 TO A. 389 | MOVE 2 TO B. 390 | CALL "Sample1" USING A B RES. 391 | MOVE "Sample1(3,2)=1" TO assert-name. 392 | CALL CBU-assert-nb3-equals 393 | USING CBU-ctx assert-name EXPECTED RES. 394 | END PROGRAM TS1. 395 | }}} 396 | 397 | If we build and run the test: 398 | 399 | *$ ./build.sh* 400 | *$ ./test.sh* 401 | 402 | The result is: 403 | 404 | {{{ 405 | |--- SUITE1 406 | | Test 'TS1' is * SUCCESS * (001 Assertions, 000 Failures. 000 errors) 407 | |--- SUCCESS 408 | 409 | 410 | ******************************************************************** 411 | * SUCCESS * 412 | * (001 test cases, 001 success, 000 failures, 000 errors) * 413 | ******************************************************************** 414 | (00 min:00 sec:01 ms) 415 | 416 | }}} 417 | 418 | * CBU still detected "SUITE1" suite which contained one test "FS1" 419 | * "TS1" has be ran and one assertion has been ran and succeed 420 | 421 | BRAVO you ve just written you first COBOLUnit tests. 422 | Next we are going to implement tests on *Sample2* and *Sample3*. 423 | Becaus i assume that uou have understood what we've just done, i just copied the source code for the suite and the test. 424 | 425 | == Sample2 tests == 426 | 427 | *TS-SUITE.cob* 428 | 429 | {{{ 430 | IDENTIFICATION DIVISION. 431 | PROGRAM-ID. TS-SUITE. 432 | ENVIRONMENT DIVISION. 433 | CONFIGURATION SECTION. 434 | DATA DIVISION. 435 | WORKING-STORAGE SECTION. 436 | COPY CBU-func. 437 | 01 str1 PIC X(20). 438 | 01 str2 PIC X(100). 439 | 01 RES PIC 99. 440 | COPY CBU-copy. 441 | PROCEDURE DIVISION . 442 | INITIALIZE str1 str2. 443 | MOVE "SUITE2" TO str1. 444 | MOVE "DESC SUITE2" TO str2. 445 | CALL CBU-initialize USING CBU-ctx. 446 | CALL CBU-add-suite USING CBU-ctx str1 str2. 447 | 448 | 449 | INITIALIZE str1 str2. 450 | MOVE "TS2" TO str1. 451 | MOVE "TEST2 desc" TO str2. 452 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 453 | 454 | CALL CBU-run USING CBU-ctx. 455 | END PROGRAM TS-SUITE. 456 | }}} 457 | 458 | 459 | *TS2.cob* 460 | 461 | {{{ 462 | IDENTIFICATION DIVISION. 463 | PROGRAM-ID. TS2. 464 | ENVIRONMENT DIVISION. 465 | CONFIGURATION SECTION. 466 | DATA DIVISION. 467 | WORKING-STORAGE SECTION. 468 | COPY CBU-func. 469 | 01 A PIC 99. 470 | 01 B PIC 99. 471 | 01 C PIC 99. 472 | 01 RES PIC 99. 473 | 01 EXPECTED PIC 99. 474 | 01 assert-name PIC X(20). 475 | LINKAGE SECTION. 476 | COPY CBU-copy. 477 | PROCEDURE DIVISION USING CBU-ctx. 478 | MOVE 5 TO EXPECTED. 479 | MOVE 5 TO A. 480 | MOVE 2 TO B. 481 | MOVE 5 TO C. 482 | CALL "Sample2" USING A B C RES. 483 | MOVE "(5,2,5)=5" TO assert-name. 484 | CALL CBU-assert-nb3-equals 485 | USING CBU-ctx assert-name EXPECTED RES. 486 | END PROGRAM TS2. 487 | }}} 488 | 489 | If we build and run the test: 490 | 491 | *$ ./build.sh* 492 | *$ ./test.sh* 493 | 494 | The result is: 495 | 496 | {{{ 497 | 498 | |--- SUITE2 499 | | Test 'TS2' is * SUCCESS * (001 Assertions, 000 Failures. 000 errors) 500 | |--- SUCCESS 501 | 502 | 503 | ******************************************************************** 504 | * SUCCESS * 505 | * (001 test cases, 001 success, 000 failures, 000 errors) * 506 | ******************************************************************** 507 | (00 min:00 sec:00 ms) 508 | 509 | 510 | }}} 511 | 512 | == Sample3 tests == 513 | 514 | In this suite, we are going to add the 2 previous Tests: 515 | 516 | {{{ 517 | *TS-SUITE.cob* 518 | *> 519 | IDENTIFICATION DIVISION. 520 | PROGRAM-ID. TS-SUITE. 521 | ENVIRONMENT DIVISION. 522 | CONFIGURATION SECTION. 523 | DATA DIVISION. 524 | WORKING-STORAGE SECTION. 525 | COPY CBU-func. 526 | 01 str1 PIC X(20). 527 | 01 str2 PIC X(100). 528 | 01 RES PIC 99. 529 | COPY CBU-copy. 530 | PROCEDURE DIVISION. 531 | INITIALIZE str1 str2. 532 | MOVE "SUITE1" TO str1. 533 | MOVE "DESC SUITE1" TO str2. 534 | CALL CBU-initialize USING CBU-ctx. 535 | CALL CBU-add-suite USING CBU-ctx str1 str2. 536 | 537 | INITIALIZE str1 str2. 538 | MOVE "TS1" TO str1. 539 | MOVE "TEST1 desc" TO str2. 540 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 541 | 542 | INITIALIZE str1 str2. 543 | MOVE "TS2" TO str1. 544 | MOVE "TEST2 desc" TO str2. 545 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 546 | 547 | INITIALIZE str1 str2. 548 | MOVE "TS3" TO str1. 549 | MOVE "TEST3 desc" TO str2. 550 | CALL CBU-add-test-next USING CBU-ctx str1 str2. 551 | 552 | CALL CBU-run USING CBU-ctx. 553 | END PROGRAM TS-SUITE. 554 | 555 | }}} 556 | 557 | *TS3.cob* 558 | 559 | {{{ 560 | *> 561 | IDENTIFICATION DIVISION. 562 | PROGRAM-ID. TS3. 563 | ENVIRONMENT DIVISION. 564 | CONFIGURATION SECTION. 565 | DATA DIVISION. 566 | WORKING-STORAGE SECTION. 567 | COPY CBU-func. 568 | 01 A PIC 99. 569 | 01 B PIC 99. 570 | 01 C PIC 99. 571 | 01 D PIC 99. 572 | 01 RES PIC 99. 573 | 01 EXPECTED PIC 99. 574 | 01 assert-name PIC X(20). 575 | LINKAGE SECTION. 576 | COPY CBU-copy. 577 | PROCEDURE DIVISION USING CBU-ctx. 578 | MOVE 7 TO EXPECTED. 579 | MOVE 2 TO A. 580 | MOVE 2 TO B. 581 | MOVE 2 TO C. 582 | MOVE 5 TO D. 583 | CALL "Sample3" USING A B C D RES. 584 | MOVE "(2,2,2,5)=7" TO assert-name. 585 | CALL CBU-assert-nb3-equals 586 | USING CBU-ctx assert-name EXPECTED RES. 587 | END PROGRAM TS3. 588 | }}} 589 | 590 | *$ ./build.sh* 591 | *$ ./test.sh* 592 | 593 | The result is: 594 | 595 | 596 | 597 | {{{ 598 | 599 | |--- SUITE1 600 | | Test 'TS1' is * SUCCESS * (001 Assertions, 000 Failures. 000 errors) 601 | | Test 'TS2' is * SUCCESS * (001 Assertions, 000 Failures. 000 errors) 602 | | Test 'TS3' is * SUCCESS * (001 Assertions, 000 Failures. 000 errors) 603 | |--- SUCCESS 604 | 605 | 606 | ******************************************************************** 607 | * SUCCESS * 608 | * (003 test cases, 003 success, 000 failures, 000 errors) * 609 | ******************************************************************** 610 | (00 min:00 sec:02 ms) 611 | 612 | }}} 613 | == What else? == 614 | 615 | 617 | 618 |
    616 |
    619 | -------------------------------------------------------------------------------- /COBOLUnitDoc/legacy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gbeine/COBOLUnit/4ef4ed3f57c6e9fc52233cbe623feb679f60d1f8/COBOLUnitDoc/legacy.png -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00000.cob: -------------------------------------------------------------------------------- 1 | 000020* COBOLUnit is a COBOL Unit framework testing 2 | 000021* 3 | 000022* Logic name: CBU-initialize 4 | 000032* source name: CBU00000.cob 5 | 000039* 6 | 000040* Copyright (C) 2009 Hervé Vaujour 7 | 000041* 8 | 000042* This program is free software; you can redistribute it and/or modify 9 | 000043* it under the terms of the GNU General Public License as published by 10 | 000044* the Free Software Foundation; either version 2 of the License, or 11 | 000045* (at your option) any later version. 12 | 000046* 13 | 000047* This program is distributed in the hope that it will be useful, 14 | 000048* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000049* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000050* GNU General Public License for more details. 17 | 000051* 18 | 000052* You should have received a copy of the GNU General Public License 19 | 000053* along with this program; see the file COPYING. If not, write to the 20 | 000054* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000055 22 | 000056 23 | 000057* reset COBOLUnit variables 24 | 000058 IDENTIFICATION DIVISION. 25 | 000059 PROGRAM-ID. CBU00000. 26 | 000060 ENVIRONMENT DIVISION. 27 | 000061 CONFIGURATION SECTION. 28 | 000062 DATA DIVISION. 29 | 000063 WORKING-STORAGE SECTION. 30 | 000064 01 i PIC 9(2). 31 | 000065 01 j PIC 9(2). 32 | 000066 01 k PIC 9(2). 33 | 000072 COPY CBUC0002. 34 | 000073 LINKAGE SECTION. 35 | 000074 COPY CBUC0001. 36 | 000075 PROCEDURE DIVISION USING CBU-ctx. 37 | 000076 MOVE 0 TO TestRunCount. 38 | 000077 MOVE 0 TO index-current-suite. 39 | 000078 MOVE 0 TO index-current-test. 40 | 000079 MOVE 0 TO RunSuccessCount. 41 | 000080 MOVE 0 TO RunFailureCount. 42 | 000081 MOVE 0 TO TestError. 43 | 000082 MOVE 0 TO nb-suite-run. 44 | 000088 PERFORM VARYING i FROM 1 BY 1 45 | 000098 UNTIL i >= SuiteIndex 46 | 000099 PERFORM VARYING j FROM 1 BY 1 47 | 000100 UNTIL ListeTests(i,j) = "" 48 | 000102 MOVE 0 TO nb-test-run (i) 49 | 000105 MOVE 0 TO nb-test-succeed (i) 50 | 000106 MOVE 0 TO nb-test-failed (i) 51 | 000107 MOVE 0 TO nb-test-error (i) 52 | 000110* PERFORM VARYING k FROM 1 BY 1 53 | 000111* UNTIL ListeAssertRuns(i,j,k) = "" 54 | 000112* MOVE 0 TO has-succeed (i,j,k) 55 | 000113* INITIALIZE AssertRunName (i,j,k) 56 | 000115* INITIALIZE AssertValueExpected (i,j,k) 57 | 000116* INITIALIZE AssertValueActual (i,j,k) 58 | 000122* END-PERFORM 59 | 000123 END-PERFORM 60 | 000124 END-PERFORM 61 | 000125 EXIT PROGRAM. 62 | 000126 END PROGRAM CBU00000. 63 | 000127 64 | 000130 65 | 000376 66 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00001.cob: -------------------------------------------------------------------------------- 1 | 000020* COBOLUnit is a COBOL Unit framework testing 2 | 000021* 3 | 000022* logic name: CBU-initialize 4 | 000023* source name: CBU00000.cob 5 | 000024* 6 | 000025* Copyright (C) 2009 Hervé Vaujour 7 | 000026* 8 | 000027* This program is free software; you can redistribute it and/or modify 9 | 000028* it under the terms of the GNU General Public License as published by 10 | 000029* the Free Software Foundation; either version 2 of the License, or 11 | 000030* (at your option) any later version. 12 | 000031* 13 | 000032* This program is distributed in the hope that it will be useful, 14 | 000033* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000034* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000035* GNU General Public License for more details. 17 | 000036* 18 | 000037* You should have received a copy of the GNU General Public License 19 | 000038* along with this program; see the file COPYING. If not, write to the 20 | 000039* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000040 22 | 000041 23 | 000042* Initialize variables for running tests suite 24 | 000043 IDENTIFICATION DIVISION. 25 | 000044 PROGRAM-ID. CBU00001. 26 | 000045 ENVIRONMENT DIVISION. 27 | 000046 CONFIGURATION SECTION. 28 | 000050 DATA DIVISION. 29 | 000060 WORKING-STORAGE SECTION. 30 | 000070 COPY CBUC0002. 31 | 000071 LINKAGE SECTION. 32 | 000072 COPY CBUC0001. 33 | 000081 PROCEDURE DIVISION USING CBU-ctx. 34 | 000093 MOVE 1 TO TestIndex. 35 | 000094 MOVE 1 TO SuiteIndex. 36 | 000095 MOVE 1 TO AssertIndex. 37 | 000099 CALL CBU-reset-run USING CBU-ctx. 38 | 000105 END PROGRAM CBU00001. 39 | 000106 40 | 000110 41 | 000376 42 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00002.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-call-test 4 | 000013* source name: CBU00002.cob 5 | 000023* 6 | 000029* Copyright (C) 2009 Hervé Vaujour 7 | 000030* 8 | 000031* This program is free software; you can redistribute it and/or modify 9 | 000032* it under the terms of the GNU General Public License as published by 10 | 000033* the Free Software Foundation; either version 2 of the License, or 11 | 000034* (at your option) any later version. 12 | 000035* 13 | 000036* This program is distributed in the hope that it will be useful, 14 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000039* GNU General Public License for more details. 17 | 000040* 18 | 000041* You should have received a copy of the GNU General Public License 19 | 000042* along with this program; see the file COPYING. If not, write to the 20 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000044 22 | 000050* Run a test 23 | 000110* arg1: NomTest-Test name to run 24 | 000120 IDENTIFICATION DIVISION. 25 | 000130 PROGRAM-ID. CBU00002. 26 | 000140 DATA DIVISION. 27 | 000150 WORKING-STORAGE SECTION. 28 | 000161 01 LineToLog PIC X(255). 29 | 000170 01 NomRunTest PIC X(20) VALUES SPACES. 30 | 000171 COPY CBUC0002. 31 | 000180 LINKAGE SECTION. 32 | 000190 01 NomTest PIC X(20). 33 | 000191 COPY CBUC0001. 34 | 000200 35 | 000210 PROCEDURE DIVISION USING CBU-ctx NomTest. 36 | 000230 ADD 1 TO TestRunCount 37 | 000260 MOVE NomTest TO name-current-test. 38 | 000261 INITIALIZE LineToLog. 39 | 000288 INITIALIZE LineToLog. 40 | 000289 CALL NomTest USING CBU-ctx 41 | 000290 ON EXCEPTION CALL CBU-add-error USING CBU-ctx. 42 | 000328 EXIT PROGRAM. 43 | 000330 END PROGRAM CBU00002. 44 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00003.cob: -------------------------------------------------------------------------------- 1 | 000100* COBOLUnit is a COBOL Unit framework testing 2 | 000101* 3 | 000102* Logic name: CBU-un 4 | 000103* source name: CBU00003.cob 5 | 000113* 6 | 000119* Copyright (C) 2009 Hervé Vaujour 7 | 000120* 8 | 000121* This program is free software; you can redistribute it and/or modify 9 | 000122* it under the terms of the GNU General Public License as published by 10 | 000123* the Free Software Foundation; either version 2 of the License, or 11 | 000124* (at your option) any later version. 12 | 000125* 13 | 000126* This program is distributed in the hope that it will be useful, 14 | 000127* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000128* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000129* GNU General Public License for more details. 17 | 000130* 18 | 000131* You should have received a copy of the GNU General Public License 19 | 000132* along with this program; see the file COPYING. If not, write to the 20 | 000133* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000134 22 | 000135 23 | 000140*> Run cbu 24 | 000273 IDENTIFICATION DIVISION. 25 | 000274 PROGRAM-ID. CBU00003. 26 | 000275 ENVIRONMENT DIVISION. 27 | 000276 INPUT-OUTPUT SECTION. 28 | 000277 FILE-CONTROL. 29 | 000278 SELECT LogFile ASSIGN TO currentLogFile 30 | 000279 ORGANIZATION IS LINE SEQUENTIAL. 31 | 000281 DATA DIVISION. 32 | 000282 FILE SECTION. 33 | 000283 FD LogFile. 34 | 000284 01 LogLine PIC X(255). 35 | 000290 WORKING-STORAGE SECTION. 36 | 000310 01 CurrentTimeDeb PIC 9(8). 37 | 000320 01 CurrentTimeFin PIC 9(8). 38 | 000321 01 lineToLog PIC X(255). 39 | 000322 01 res-str PIC X(7). 40 | 000323 01 success-str PIC X(7). 41 | 000324 01 failure-str PIC X(7). 42 | 000326 COPY CBUC0002. 43 | 000327 LINKAGE SECTION. 44 | 000328 COPY CBUC0001. 45 | 000329 PROCEDURE DIVISION USING CBU-ctx. 46 | 000330* DISPLAY "Lancement des tests". 47 | 000335 MOVE "SUCCESS" TO success-str. 48 | 000336 MOVE "FAILURE" TO failure-str. 49 | 000345 ACCEPT CurrentTimeDeb FROM TIME. 50 | 000402* DISPLAY "Lancement des suites". 51 | 000403 CALL CBU-suites-run USING CBU-ctx. 52 | 000405 INITIALIZE LineToLog. 53 | 000406 IF RunFailureCount > 0 OR TestError > 0 54 | 000407 THEN 55 | 000410 MOVE failure-str TO res-str 56 | 000412* CALL CBU-write-log-line USING lineToLog 57 | 000413 ELSE 58 | 000414 MOVE success-str TO res-str 59 | 000417* CALL CBU-write-log-line USING lineToLog 60 | 000418 END-IF 61 | 000420 62 | 000421 INITIALIZE LineToLog 63 | 000422 DISPLAY " " 64 | 000423 DISPLAY 65 | 000424 "**************************************************************" 66 | 000425 "******" 67 | 000426 DISPLAY 68 | 000427 "* " 69 | 000428 res-str " *" 70 | 000429 DISPLAY "* (" 71 | 000430 TestRunCount 72 | 000431 " test cases, " 73 | 000432 RunSuccessCount " success, " 74 | 000433 RunFailureCount " failures, " 75 | 000434 TestError " errors) *" 76 | 000435 DISPLAY 77 | 000436 "**************************************************************" 78 | 000437 "******" 79 | 000438* DISPLAY lineToLog 80 | 000439* CALL CBU-write-log-line USING lineToLog 81 | 000440 ACCEPT CurrentTimeFin FROM TIME. 82 | 000441* DISPLAY "CurrenttimeDeb: " CurrenttimeDeb. 83 | 000442* DISPLAY "CurrenttimeFin: " CurrenttimeFin. 84 | 000443 COMPUTE CurrentTimeFin = CurrentTimeFin - CurrentTimeDeb. 85 | 000444 INITIALIZE LineToLog 86 | 000445 DISPLAY "(" 87 | 000446 CurrentTimeFin(3:2) 88 | 000447 " min:" 89 | 000448 CurrentTimeFin(5:2) 90 | 000449 " sec:" 91 | 000450 CurrentTimeFin(7:2) 92 | 000451 " ms)". 93 | 000452* INTO lineToLog 94 | 000453* DISPLAY lineToLog 95 | 000454* CALL CBU-write-log-line USING lineToLog 96 | 000455 97 | 000456 EXIT PROGRAM. 98 | 000464 END PROGRAM CBU00003. 99 | 000969 100 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00004.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-suite 4 | 000013* source name: CBU00004.cob 5 | 000023* 6 | 000029* Copyright (C) 2009 Hervé Vaujour 7 | 000030* 8 | 000031* This program is free software; you can redistribute it and/or modify 9 | 000032* it under the terms of the GNU General Public License as published by 10 | 000033* the Free Software Foundation; either version 2 of the License, or 11 | 000034* (at your option) any later version. 12 | 000035* 13 | 000036* This program is distributed in the hope that it will be useful, 14 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000039* GNU General Public License for more details. 17 | 000040* 18 | 000041* You should have received a copy of the GNU General Public License 19 | 000042* along with this program; see the file COPYING. If not, write to the 20 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000044 22 | 000045 23 | 000046*> 24 | 000047* Add a suite to the cobol unit framework 25 | 000048* arg1: Nom-Suite name 26 | 000049* arg2: Desc-Suite description 27 | 000050 IDENTIFICATION DIVISION. 28 | 000051 PROGRAM-ID. CBU00004. 29 | 000052 DATA DIVISION. 30 | 000060 WORKING-STORAGE SECTION. 31 | 000070 COPY CBUC0002. 32 | 000117 33 | 000120 LINKAGE SECTION. 34 | 000130 01 Nom PIC X(20) VALUE SPACES. 35 | 000140 01 Desc PIC X(100) VALUE SPACES. 36 | 000150 COPY CBUC0001. 37 | 000160 PROCEDURE DIVISION USING CBU-ctx Nom Desc. 38 | 000172 IF TestIndex > 1 39 | 000180 THEN MOVE 1 TO TestIndex 40 | 000190 END-IF. 41 | 000191 INITIALIZE SuiteName(SuiteIndex). 42 | 000192 INITIALIZE SuiteDesc(SuiteIndex). 43 | 000200 MOVE Nom TO SuiteName(SuiteIndex). 44 | 000210 Move Desc TO SuiteDesc(SuiteIndex). 45 | 000211 MOVE 0 TO suite-size(SuiteIndex). 46 | 000212 MOVE 0 TO nb-test-size(SuiteIndex). 47 | 000213 MOVE 0 TO nb-test-run(SuiteIndex). 48 | 000214 MOVE 0 TO nb-test-succeed(SuiteIndex). 49 | 000215 MOVE 0 TO nb-test-failed(SuiteIndex). 50 | 000225 MOVE 0 TO nb-test-error(SuiteIndex). 51 | 000241 ADD 1 TO SuiteIndex. 52 | 000250 EXIT PROGRAM. 53 | 000260 END PROGRAM CBU00004. 54 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00005.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* source name: CBU00005.cob 4 | 000013* 5 | 000014* Copyright (C) 2009 Hervé Vaujour 6 | 000015* 7 | 000025* Logic name: CBU-add-test 8 | 000029* Copyright (C) 2009 Hervé Vaujour 9 | 000030* 10 | 000031* This program is free software; you can redistribute it and/or modify 11 | 000032* it under the terms of the GNU General Public License as published by 12 | 000033* the Free Software Foundation; either version 2 of the License, or 13 | 000034* (at your option) any later version. 14 | 000035* 15 | 000036* This program is distributed in the hope that it will be useful, 16 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | 000039* GNU General Public License for more details. 19 | 000040* 20 | 000041* You should have received a copy of the GNU General Public License 21 | 000042* along with this program; see the file COPYING. If not, write to the 22 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 | 000044 24 | 000045 25 | 000050*> 26 | 000100* Add a test 27 | 000101* arg1: Nom - Test name 28 | 000102* arg2: Desc - Test description 29 | 000103* TODO: Specify the suite where to add the test 30 | 000110 IDENTIFICATION DIVISION. 31 | 000120 PROGRAM-ID. CBU00005. 32 | 000130 DATA DIVISION. 33 | 000140 WORKING-STORAGE SECTION. 34 | 000150 COPY CBUC0002. 35 | 000200 LINKAGE SECTION. 36 | 000201 COPY CBUC0001. 37 | 000202 01 id-suite PIC 9(2). 38 | 000210 01 Nom PIC X(20) VALUE SPACES. 39 | 000220 01 Desc PIC X(100) VALUE SPACES. 40 | 000230 41 | 000240 PROCEDURE DIVISION USING CBU-ctx id-suite Nom Desc. 42 | 000251 MOVE Nom TO TestName(id-suite,TestIndex). 43 | 000260 MOVE Desc TO TestDesc(id-suite,TestIndex). 44 | 000271 MOVE 0 TO nb-assert-run(id-suite,TestIndex). 45 | 000273 MOVE 0 TO nb-assert-succeed(id-suite,TestIndex). 46 | 000274 MOVE 0 TO nb-assert-failed(id-suite,TestIndex). 47 | 000280 48 | 000290 MOVE "ø" TO CarRetourChariot. 49 | 000331 ADD 1 TO testIndex. 50 | 000332 ADD 1 TO nb-test-size(id-suite). 51 | 000333* DISPLAY "Suite: " id-suite ", size: " 52 | 000334* nb-test-size(id-suite). 53 | 000335 54 | 000340 EXIT PROGRAM. 55 | 000350 END PROGRAM CBU00005. 56 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00006.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-suites-run 4 | 000013* source name: CBU00006.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*> Run Suites test 25 | 000047 IDENTIFICATION DIVISION. 26 | 000048 PROGRAM-ID. CBU00006. 27 | 000049 ENVIRONMENT DIVISION. 28 | 000050 CONFIGURATION SECTION. 29 | 000060 DATA DIVISION. 30 | 000070 WORKING-STORAGE SECTION. 31 | 000071 01 i PIC 9(2). 32 | 000081 01 str PIC X(32000). 33 | 000082 01 WS-CNT PIC 99999. 34 | 000090 COPY CBUC0002. 35 | 000091 LINKAGE SECTION. 36 | 000092 COPY CBUC0001. 37 | 000093 PROCEDURE DIVISION USING CBU-ctx. 38 | 000094 PERFORM VARYING i FROM 1 BY 1 39 | 000095 UNTIL i >= SuiteIndex 40 | 000096 INITIALIZE log-entete-suite 41 | 000097 INITIALIZE str 42 | 000099 DISPLAY "|--- " SuiteName(i) 43 | 000100 MOVE SuiteName (i) TO str 44 | 000110 CALL CBU-suite-run USING CBU-ctx i 45 | 000115 IF nb-test-error(i) > 0 OR nb-test-failed(i) > 0 THEN 46 | 000125 DISPLAY "|--- FAILURE" 47 | 000135 ELSE 48 | 000145 DISPLAY "|--- SUCCESS" 49 | 000146 END-IF 50 | 000147 DISPLAY "" 51 | 000151 END-PERFORM 52 | 000152 EXIT PROGRAM. 53 | 000160 END PROGRAM CBU00006. 54 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00007.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-suite-run 4 | 000013* source name: CBU00007.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*> Run a suite 25 | 000047* arg1: suite-index - index of the suite to run 26 | 000048 27 | 000049 IDENTIFICATION DIVISION. 28 | 000050 PROGRAM-ID. CBU00007. 29 | 000051 ENVIRONMENT DIVISION. 30 | 000052 CONFIGURATION SECTION. 31 | 000060 DATA DIVISION. 32 | 000070 WORKING-STORAGE SECTION. 33 | 000072 01 str PIC X(20). 34 | 000075 01 lineToLog PIC X(255). 35 | 000089 COPY CBUC0002. 36 | 000090 LINKAGE SECTION. 37 | 000091 COPY CBUC0001. 38 | 000092 01 i PIC 9(2). 39 | 000093 40 | 000094 PROCEDURE DIVISION USING CBU-ctx i. 41 | 000095 MOVE i TO index-current-suite. 42 | 000096 ADD 1 TO nb-suite-run . 43 | 000111 CALL CBU-tests-run USING CBU-ctx. 44 | 000115 END PROGRAM CBU00007. 45 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00008.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-tests-run 4 | 000013* source name: CBU00008.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*> Run tests 25 | 000047 IDENTIFICATION DIVISION. 26 | 000048 PROGRAM-ID. CBU00008. 27 | 000049 ENVIRONMENT DIVISION. 28 | 000050 CONFIGURATION SECTION. 29 | 000060 DATA DIVISION. 30 | 000070 WORKING-STORAGE SECTION. 31 | 000071 01 j PIC 9(2). 32 | 000076 COPY CBUC0002. 33 | 000086 LINKAGE SECTION. 34 | 000087 COPY CBUC0001. 35 | 000088 PROCEDURE DIVISION USING CBU-ctx. 36 | 000090 PERFORM VARYING j FROM 1 BY 1 37 | 000091 UNTIL j>nb-test-size(index-current-suite) 38 | 000101* MOVE 1 TO index-current-assert 39 | 000135 CALL CBU-test-run USING CBU-ctx j 40 | 000136 END-PERFORM 41 | 000137 EXIT PROGRAM. 42 | 000140 END PROGRAM CBU00008. 43 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00009.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-test-run 4 | 000013* source name: CBU00009.cob 5 | 000023* 6 | 000029* Copyright (C) 2009 Hervé Vaujour 7 | 000030* 8 | 000031* This program is free software; you can redistribute it and/or modify 9 | 000032* it under the terms of the GNU General Public License as published by 10 | 000033* the Free Software Foundation; either version 2 of the License, or 11 | 000034* (at your option) any later version. 12 | 000035* 13 | 000036* This program is distributed in the hope that it will be useful, 14 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000039* GNU General Public License for more details. 17 | 000040* 18 | 000041* You should have received a copy of the GNU General Public License 19 | 000042* along with this program; see the file COPYING. If not, write to the 20 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000044 22 | 000045 23 | 000046*> Run a test 24 | 000047* arg1: test-index - index of the test to run 25 | 000048 IDENTIFICATION DIVISION. 26 | 000049 PROGRAM-ID. CBU00009. 27 | 000050 ENVIRONMENT DIVISION. 28 | 000051 CONFIGURATION SECTION. 29 | 000060 DATA DIVISION. 30 | 000070 WORKING-STORAGE SECTION. 31 | 000071 COPY CBUC0002. 32 | 000072 01 nTest PIC X(20). 33 | 000073 77 WS-CNT1 PIC 999. 34 | 000074 01 res-str PIC X(7). 35 | 000075 01 success-str PIC X(7). 36 | 000076 01 failure-str PIC X(7). 37 | 000077 01 str PIC X(20). 38 | 000078 01 log-line PIC X(32000). 39 | 000079 01 log-line-index PIC 99999. 40 | 000080 01 index1 PIC 99999. 41 | 000081 01 index2 PIC 99999. 42 | 000082 01 taille PIC 99999. 43 | 000085 44 | 000090 45 | 000096 46 | 000097 LINKAGE SECTION. 47 | 000098 COPY CBUC0001. 48 | 000099 01 index-test PIC 9(2). 49 | 000100 PROCEDURE DIVISION USING CBU-ctx index-test. 50 | 000105* DISPLAY "Lancement du test: " index-test. 51 | 000106 MOVE "SUCCESS" TO success-str. 52 | 000107 MOVE "FAILURE" TO failure-str. 53 | 000108 MOVE index-test TO index-current-test. 54 | 000109 MOVE TestName 55 | 000110 (index-current-suite, 56 | 000111 index-current-test) 57 | 000112 TO nTest 58 | 000113 MOVE 0 TO AssertTestCount 59 | 000114 MOVE 0 TO AssertFailureCount 60 | 000115 MOVE 0 to WS-CNT1 61 | 000116 MOVE function Reverse(nTest) to str 62 | 000117 Inspect str Tallying WS-CNT1 63 | 000118 For Leading space 64 | 000119 IF WS-CNT1 IS EQUAL TO 0 THEN 65 | 000120 Inspect str Tallying WS-CNT1 66 | 000121 For Leading X"00" 67 | 000122 END-IF 68 | 000123 Compute WS-CNT1 = length of str - WS-CNT1 69 | 000124* INITIALIZE LineToLog 70 | 000125 INITIALIZE log-entete-test 71 | 000126 INITIALIZE log-asserts-res 72 | 000127 INITIALIZE log-fin-test 73 | 000128 INITIALIZE log-line. 74 | 000129 STRING 75 | 000130 "| Test '" 76 | 000131 nTest(1:WS-CNT1) 77 | 000132 "' is running..." 78 | 000133 INTO log-entete-test. 79 | 000134 CALL CBU-call-test USING 80 | 000135 CBU-ctx nTest 81 | 000136 nb-test-run(index-current-suite) 82 | 000137 ADD 1 TO nb-test-run(index-current-suite) 83 | 000138 IF nb-assert-failed(index-current-suite, 84 | 000139 index-current-test) <> 0 OR TestError > 0 THEN 85 | 000140 MOVE failure-str TO res-str 86 | 000141 ELSE MOVE success-str TO res-str 87 | 000142 END-IF 88 | 000143 89 | 000152 STRING 90 | 000153 " * " res-str" *" 91 | 000156 " (" 92 | 000157 nb-assert-run (index-current-suite, 93 | 000158 index-current-test) 94 | 000159 " Assertions, " 95 | 000160 nb-assert-failed (index-current-suite, 96 | 000161 index-current-test) 97 | 000162 " Failures. " 98 | 000163 TestError " errors)" INTO log-fin-test 99 | 000165 STRING log-entete-test log-fin-test 100 | 000166 INTO log-line 101 | 000167 CALL CBU-get-last-index USING CBU-ctx log-line log-line-index 102 | 000171 DISPLAY log-line(1:log-line-index) 103 | 000172 MOVE 1 TO index1. 104 | 000173 MOVE 1 TO index2. 105 | 000174 CALL CBU-get-last-index USING 106 | 000175 CBU-ctx log-asserts-res log-line-index 107 | 000176* DISPLAY log-asserts-res (1:log-line-index) 108 | 000177 Perform varying index1 from 1 by 1 109 | 000178 until index1 > log-line-index 110 | 000179 if log-asserts-res(index1:1) = "$" 111 | 000180 COMPUTE taille = index1 - index2 - 1 112 | 000181 ADD 1 TO index2 113 | 000182 DISPLAY "| " log-asserts-res(index2:taille) 114 | 000183 MOVE index1 TO index2 115 | 000184 ADD 1 TO index1 116 | 000185 end-if 117 | 000186 end-perform 118 | 000187 COMPUTE taille = index1 - index2 - 1 119 | 000189 ADD 1 TO index2. 120 | 000191* DISPLAY lineToLog 121 | 000192* MOVE lineToLog TO Log(LogListindex) 122 | 000193* ADD 1 TO LogListIndex 123 | 000194* CALL CBU-write-log-line USING lineToLog 124 | 000195 125 | 000196 IF AssertFailureCount <> 0 THEN 126 | 000197 ADD 1 TO RunFailureCount 127 | 000198 ELSE 128 | 000199 IF TestError =0 THEN 129 | 000200 ADD 1 TO RunSuccessCount 130 | 000201 END-IF 131 | 000202 END-IF 132 | 000203 EXIT PROGRAM. 133 | 000210 END PROGRAM CBU00009. 134 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00011.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-set-log-file 4 | 000013* source name: CBU00011.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*> set file log 25 | 000047* arg1: file-name log file name 26 | 000048 IDENTIFICATION DIVISION. 27 | 000049 PROGRAM-ID. CBU00011. 28 | 000050 ENVIRONMENT DIVISION. 29 | 000051 INPUT-OUTPUT SECTION. 30 | 000052 FILE-CONTROL. 31 | 000053 SELECT LogFile ASSIGN TO currentLogFile 32 | 000054 ORGANIZATION IS LINE SEQUENTIAL. 33 | 000055 DATA DIVISION. 34 | 000056 FILE SECTION. 35 | 000057 FD LogFile. 36 | 000058 01 LogLine PIC X(255). 37 | 000067 WORKING-STORAGE SECTION. 38 | 000068 77 str1 PIC X(24). 39 | 000069 77 WS-CNT1 PIC 99. 40 | 000070 COPY CBUC0002. 41 | 000071 LINKAGE SECTION. 42 | 000073 77 file-name PIC X(24). 43 | 000074 COPY CBUC0001. 44 | 000080 PROCEDURE DIVISION USING CBU-ctx file-name. 45 | 000081 MOVE 0 to WS-CNT1. 46 | 000082 MOVE FUNCTION Reverse(file-name) to str1. 47 | 000083 48 | 000084 Inspect str1 Tallying WS-CNT1 For Leading space 49 | 000085 IF WS-CNT1 IS EQUAL TO 0 THEN 50 | 000086 Inspect str1 Tallying WS-CNT1 For Leading X"00" 51 | 000087 END-IF 52 | 000088 Compute WS-CNT1 = length of str1 - WS-CNT1. 53 | 000092 54 | 000093 STRING file-name(1:WS-CNT1) ".DAT" 55 | 000095 INTO currentLogFile 56 | 000096 DISPLAY "Log file: " currentLogFile 57 | 000097 INITIALIZE LogLine. 58 | 000098* Create suite log file 59 | 000099 OPEN OUTPUT LogFile. 60 | 000100 WRITE LogLine. 61 | 000101 CLOSE LogFile. 62 | 000110 END PROGRAM CBU00011. 63 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00012.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-test-next 4 | 000013* source name: CBU00012.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*> add test to the current suite 25 | 000047 IDENTIFICATION DIVISION. 26 | 000048 PROGRAM-ID. CBU00012. 27 | 000049 ENVIRONMENT DIVISION. 28 | 000050 DATA DIVISION. 29 | 000067 WORKING-STORAGE SECTION. 30 | 000068 01 nb-suite-pos PIC 9(2). 31 | 000070 COPY CBUC0002. 32 | 000072 LINKAGE SECTION. 33 | 000073 01 Nom PIC X(20) VALUE SPACES. 34 | 000074 01 Desc PIC X(100) VALUE SPACES. 35 | 000076 COPY CBUC0001. 36 | 000086 PROCEDURE DIVISION USING CBU-ctx Nom Desc. 37 | 000087 MOVE 0 TO nb-suite-pos. 38 | 000096* DISPLAY "Suite Index (ds add test)="SuiteIndex. 39 | 000097 COMPUTE nb-suite-pos = SuiteIndex - 1. 40 | 000098* DISPLAY "Add test to Suite("nb-suite-pos")" . 41 | 000103 CALL CBU-add-test USING CBU-ctx nb-suite-pos Nom Desc. 42 | 000110 END PROGRAM CBU00012. 43 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00020.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-access-succeed 4 | 000013* source name: CBU00020.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046 25 | 000047*>add a success to an assertion 26 | 000048 IDENTIFICATION DIVISION. 27 | 000050 PROGRAM-ID. CBU00020. 28 | 000083 DATA DIVISION. 29 | 000084 WORKING-STORAGE SECTION. 30 | 000085 COPY CBUC0002. 31 | 000086 LINKAGE SECTION. 32 | 000087 COPY CBUC0001. 33 | 000088 77 AssertName PIC X(20). 34 | 000090 PROCEDURE DIVISION USING CBU-ctx AssertName. 35 | 000091 ADD 1 TO AssertTestCount. 36 | 000092 ADD 1 TO nb-assert-succeed 37 | 000093 (index-current-suite, 38 | 000094 index-current-test). 39 | 000099* MOVE AssertName 40 | 000100* TO AssertRunName 41 | 000101* (index-current-suite, 42 | 000102* index-current-test, 43 | 000103* index-current-assert). 44 | 000104* MOVE 1 45 | 000105* TO has-succeed 46 | 000106* (index-current-suite, 47 | 000107* index-current-test, 48 | 000108* index-current-assert). 49 | 000109* ADD 1 TO index-current-assert. 50 | 000110 EXIT PROGRAM. 51 | 000120 END PROGRAM CBU00020. 52 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00025.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-assert-run 4 | 000013* source name: CBU00025.cob 5 | 000023* 6 | 000029* Copyright (C) 2009 Hervé Vaujour 7 | 000030* 8 | 000031* This program is free software; you can redistribute it and/or modify 9 | 000032* it under the terms of the GNU General Public License as published by 10 | 000033* the Free Software Foundation; either version 2 of the License, or 11 | 000034* (at your option) any later version. 12 | 000035* 13 | 000036* This program is distributed in the hope that it will be useful, 14 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000039* GNU General Public License for more details. 17 | 000040* 18 | 000041* You should have received a copy of the GNU General Public License 19 | 000042* along with this program; see the file COPYING. If not, write to the 20 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000044 22 | 000045 23 | 000046 24 | 000047*>add an assertion run 25 | 000048 IDENTIFICATION DIVISION. 26 | 000050 PROGRAM-ID. CBU00025. 27 | 000083 DATA DIVISION. 28 | 000084 WORKING-STORAGE SECTION. 29 | 000085 COPY CBUC0002. 30 | 000086 LINKAGE SECTION. 31 | 000087 COPY CBUC0001. 32 | 000088 01 AssertN PIC X(20). 33 | 000089 PROCEDURE DIVISION USING CBU-ctx AssertN. 34 | 000090* ADD 1 TO AssertTestCount. 35 | 000093 ADD 1 TO nb-assert-run 36 | 000094 (index-current-suite, index-current-test). 37 | 000095* MOVE AssertN TO AssertRunName 38 | 000096* (index-current-suite, 39 | 000097* index-current-test, 40 | 000098* index-current-assert). 41 | 000099 EXIT PROGRAM. 42 | 000100 END PROGRAM CBU00025. 43 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00030.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-assert-failed 4 | 000013* source name: CBU00030.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*>add an assert failed 25 | 000047 IDENTIFICATION DIVISION. 26 | 000050 PROGRAM-ID. CBU00030. 27 | 000083 DATA DIVISION. 28 | 000084 WORKING-STORAGE SECTION. 29 | 000085 COPY CBUC0002. 30 | 000086 LINKAGE SECTION. 31 | 000087 77 AssertName PIC X(20). 32 | 000088 77 ResExpected PIC X(32000). 33 | 000089 77 ResActual PIC X(32000). 34 | 000090 COPY CBUC0001. 35 | 000091 PROCEDURE DIVISION USING 36 | 000092 CBU-ctx AssertName ResExpected ResActual. 37 | 000093 ADD 1 TO AssertFailureCount. 38 | 000094 ADD 1 TO nb-assert-failed 39 | 000095 (index-current-suite, index-current-test). 40 | 000096* MOVE AssertName 41 | 000097* TO AssertRunName 42 | 000098* (index-current-suite, 43 | 000099* index-current-test, 44 | 000100* index-current-assert). 45 | 000101* MOVE 0 TO has-succeed 46 | 000102* (index-current-suite, 47 | 000103* index-current-test, 48 | 000104* index-current-assert). 49 | 000105* MOVE ResExpected TO AssertValueExpected 50 | 000106* (index-current-suite, 51 | 000107* index-current-test, 52 | 000108* index-current-assert). 53 | 000109* MOVE ResActual TO AssertValueActual 54 | 000110* (index-current-suite, 55 | 000111* index-current-test, 56 | 000112* index-current-assert). 57 | 000113* ADD 1 TO index-current-assert. 58 | 000114 EXIT PROGRAM. 59 | 000120 END PROGRAM CBU00030. 60 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00040.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-add-error 4 | 000013* source name: CBU00040.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000050*>add an error if a test failed in error 25 | 000110 IDENTIFICATION DIVISION. 26 | 000120 PROGRAM-ID. CBU00040. 27 | 000130 DATA DIVISION. 28 | 000140 WORKING-STORAGE SECTION. 29 | 000150 COPY CBUC0002. 30 | 000151 LINKAGE SECTION. 31 | 000152 COPY CBUC0001. 32 | 000160 PROCEDURE DIVISION USING CBU-ctx. 33 | 000180 ADD 1 TO TestError. 34 | 000181 ADD 1 TO nb-test-error 35 | 000182 (index-current-suite). 36 | 000190 EXIT PROGRAM. 37 | 000200 END PROGRAM CBU00040. 38 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00050.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-log-assert-succeed 4 | 000013* source name: CBU00050.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046 25 | 000047*>Log an assertion succeed specifying 26 | 000048* arg1: AssertName - Assertion name that succeed 27 | 000049 IDENTIFICATION DIVISION. 28 | 000050 PROGRAM-ID. CBU00050. 29 | 000096 DATA DIVISION. 30 | 000100 31 | 000101 WORKING-STORAGE SECTION. 32 | 000102 77 WS-CNT3 PIC 9999. 33 | 000103 77 CharCount3 PIC 99. 34 | 000104 77 LogLine PIC X(255). 35 | 000105 COPY CBUC0002. 36 | 000106 LINKAGE SECTION. 37 | 000107 77 AssertName PIC X(20). 38 | 000108 COPY CBUC0001. 39 | 000109 PROCEDURE DIVISION USING CBU-ctx AssertName. 40 | 000110 INITIALIZE LogLine. 41 | 000111 PERFORM VARYING CharCount3 FROM 19 BY -1 42 | 000112 UNTIL AssertName(CharCount3:1) <> SPACE 43 | 000113 END-PERFORM 44 | 000114* DISPLAY 45 | 000115* " Assert '" 46 | 000116* AssertName(1:CharCount3) 47 | 000117* "' Success.". 48 | 000124* CALL CBU-write-log-line 49 | 000125* USING LogLine. 50 | 000127 51 | 000128 EXIT PROGRAM. 52 | 000130 END PROGRAM CBU00050. 53 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00060.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-log-assert-failed 4 | 000013* source name: CBU00060.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046 25 | 000047*>Log an assertion failed specifying 26 | 000048* the expected result and the result returned 27 | 000049* arg1: AssertName - Assertion name that failed 28 | 000050* arg2: ResExpected - Expected result 29 | 000051* arg3: ResActual - result returned 30 | 000052 IDENTIFICATION DIVISION. 31 | 000060 PROGRAM-ID. CBU00060. 32 | 000093 DATA DIVISION. 33 | 000094 WORKING-STORAGE SECTION. 34 | 000101 77 str1 PIC X(32000). 35 | 000102 77 str2 PIC X(32000). 36 | 000103 77 str3 PIC X(20). 37 | 000104 77 str4 PIC X(32000). 38 | 000106 77 WS-CNT1 PIC 99999. 39 | 000107 77 WS-CNT2 PIC 99999. 40 | 000108 41 | 000109 77 WS-CNT4 PIC 99999. 42 | 000110 77 str-ptr PIC 99999. 43 | 000111 77 WS-CNT3 PIC 99. 44 | 000112 77 LogLine PIC X(255). 45 | 000113 COPY CBUC0002. 46 | 000114 LINKAGE SECTION. 47 | 000115 77 AssertName PIC X(20). 48 | 000116 77 ResExpected PIC X(32000). 49 | 000117 77 ResActual PIC X(32000). 50 | 000118 COPY CBUC0001. 51 | 000122 PROCEDURE DIVISION 52 | 000132 USING CBU-ctx AssertName ResExpected ResActual. 53 | 000144** parse to avoid blank on ResExpected 54 | 000145 MOVE 0 to WS-CNT1. 55 | 000146 INITIALIZE str1. 56 | 000147 MOVE FUNCTION Reverse(ResExpected) to str1. 57 | 000148 Inspect str1 Tallying WS-CNT1 For Leading space 58 | 000149 IF WS-CNT1 IS EQUAL TO 0 THEN 59 | 000150 Inspect str1 Tallying WS-CNT1 For Leading X"00" 60 | 000151 END-IF 61 | 000152 Compute WS-CNT1 = length of str1 - WS-CNT1. 62 | 000153** 63 | 000154** parse to avoid blank on ResActual 64 | 000155 MOVE 0 to WS-CNT2. 65 | 000156 INITIALIZE str2. 66 | 000158 MOVE FUNCTION Reverse(ResActual) to str2. 67 | 000159 Inspect str2 Tallying WS-CNT2 For Leading space 68 | 000160 IF WS-CNT2 IS EQUAL TO 0 THEN 69 | 000161 Inspect str2 Tallying WS-CNT2 For Leading X"00" 70 | 000162 END-IF 71 | 000163 Compute WS-CNT2 = length of str2 - WS-CNT2. 72 | 000164 73 | 000165** 74 | 000166** parse to avoid blank on AssertName 75 | 000167 MOVE 0 to WS-CNT3. 76 | 000168 INITIALIZE str3. 77 | 000169 MOVE FUNCTION Reverse(AssertName) to str3. 78 | 000170 Inspect str3 Tallying WS-CNT3 For Leading space 79 | 000171 IF WS-CNT3 IS EQUAL TO 0 THEN 80 | 000172 Inspect str3 Tallying WS-CNT3 For Leading X"00" 81 | 000173 END-IF 82 | 000174 Compute WS-CNT3 = length of str3 - WS-CNT3. 83 | 000198 84 | 000199 STRING 85 | 000200 "assertion '" 86 | 000201 AssertName(1:WS-CNT3) 87 | 000202 "' failure (expected: '" 88 | 000203 ResExpected(1:WS-CNT1) 89 | 000204 "' but was '" 90 | 000205 ResActual(1:WS-CNT2) 91 | 000206 ")'$" INTO str4. 92 | 000216 93 | 000217 CALL CBU-get-last-index USING CBU-ctx str4 WS-CNT4. 94 | 000219 CALL CBU-get-last-index 95 | 000220 USING CBU-ctx log-asserts-res str-ptr. 96 | 000221 IF str-ptr=0 THEN 97 | 000223 ADD 1 TO str-ptr 98 | 000227 END-IF. 99 | 000228 ADD 1 TO str-ptr 100 | 000229 STRING 101 | 000230 str4(1:WS-CNT4) INTO log-asserts-res 102 | 000231 WITH POINTER str-ptr. 103 | 000232 EXIT PROGRAM. 104 | 000240 END PROGRAM CBU00060. 105 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00080.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-write-log-line 4 | 000013* source name: CBU00080.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045* write a line in the log file 24 | 000046* arg1: LogL-line to write in the log file 25 | 000047 IDENTIFICATION DIVISION. 26 | 000048 PROGRAM-ID. CBU00080. 27 | 000049 ENVIRONMENT DIVISION. 28 | 000050 INPUT-OUTPUT SECTION. 29 | 000051 FILE-CONTROL. 30 | 000052 SELECT LogFile ASSIGN TO currentLogFile 31 | 000054 ORGANIZATION IS LINE SEQUENTIAL. 32 | 000060 DATA DIVISION. 33 | 000061 FILE SECTION. 34 | 000062 FD LogFile. 35 | 000063 01 LogLine PIC X(255). 36 | 000070 WORKING-STORAGE SECTION. 37 | 000071 COPY CBUC0002. 38 | 000072 LINKAGE SECTION. 39 | 000073 77 LogL PIC X(255). 40 | 000074 COPY CBUC0001. 41 | 000075 42 | 000080 PROCEDURE DIVISION USING CBU-ctx LogL. 43 | 000081 INITIALIZE LogLine. 44 | 000083 DISPLAY LogL. 45 | 000085* MOVE LogL TO LogLine. 46 | 000090* Write Log 47 | 000092* OPEN EXTEND LogFile. 48 | 000093* WRITE LogLine. 49 | 000094* CLOSE LogFile. 50 | 000100 END PROGRAM CBU00080. 51 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00100.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000021* Logic name: CBU-assert-str100-equals 4 | 000029* Copyright (C) 2009 Hervé Vaujour 5 | 000030* 6 | 000031* This program is free software; you can redistribute it and/or modify 7 | 000032* it under the terms of the GNU General Public License as published by 8 | 000033* the Free Software Foundation; either version 2 of the License, or 9 | 000034* (at your option) any later version. 10 | 000035* 11 | 000036* This program is distributed in the hope that it will be useful, 12 | 000037* but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | 000038* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | 000039* GNU General Public License for more details. 15 | 000040* 16 | 000041* You should have received a copy of the GNU General Public License 17 | 000042* along with this program; see the file COPYING. If not, write to the 18 | 000043* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | 000044 20 | 000045 21 | 000046*>Make equals assertion for PIC X(100) 22 | 000047* arg1: AssertName - Assertion naome 23 | 000048* arg2: ResExpected - Value expected 24 | 000049* arg3: ResActual - value returned 25 | 000050 IDENTIFICATION DIVISION. 26 | 000060 PROGRAM-ID. CBU00100. 27 | 000083 DATA DIVISION. 28 | 000084 WORKING-STORAGE SECTION. 29 | 000085 77 str1 PIC X(100). 30 | 000086 77 str2 PIC X(100). 31 | 000089 77 WS-CNT1 PIC 999. 32 | 000090 77 WS-CNT2 PIC 999. 33 | 000094 COPY CBUC0002. 34 | 000095 LINKAGE SECTION. 35 | 000096 77 ResExpected PIC X(100). 36 | 000097 77 ResActual PIC X(100). 37 | 000098 77 AssertName PIC X(20). 38 | 000099 COPY CBUC0001. 39 | 000100 PROCEDURE DIVISION 40 | 000101 USING CBU-ctx AssertName ResExpected ResActual. 41 | 000102 CALL CBU-add-assert-run USING CBU-ctx AssertName. 42 | 000103 MOVE 0 to WS-CNT1. 43 | 000104 MOVE 0 to WS-CNT2. 44 | 000107 MOVE FUNCTION Reverse(ResExpected) to str1. 45 | 000108 MOVE FUNCTION Reverse(ResExpected) to str2. 46 | 000109 Inspect str1 Tallying WS-CNT1 For Leading space 47 | 000111 IF WS-CNT1 IS EQUAL TO 0 THEN 48 | 000112 Inspect str1 Tallying WS-CNT1 For Leading X"00" 49 | 000113 END-IF 50 | 000116 Inspect str2 Tallying WS-CNT2 For Leading space 51 | 000117 IF WS-CNT2 IS EQUAL TO 0 THEN 52 | 000118 Inspect str2 Tallying WS-CNT2 For Leading X"00" 53 | 000119 END-IF 54 | 000120 Compute WS-CNT1 = length of str1 - WS-CNT1. 55 | 000123 Compute WS-CNT2 = length of str2 - WS-CNT2. 56 | 000132 IF ResExpected(1:WS-CNT1)<>ResActual(1:WS-CNT2) 57 | 000133 THEN 58 | 000134 CALL CBU-add-assert-failed 59 | 000135 USING CBU-ctx AssertName ResExpected ResActual 60 | 000137 CALL CBU-log-assert-failed 61 | 000138 USING CBU-ctx AssertName ResExpected ResActual 62 | 000139 ELSE 63 | 000140 CALL CBU-add-assert-succeed 64 | 000141 USING CBU-ctx AssertName 65 | 000142 CALL CBU-log-assert-succeed 66 | 000143 USING CBU-ctx AssertName 67 | 000144 END-IF. 68 | 000145 EXIT PROGRAM. 69 | 000150 END PROGRAM CBU00100. 70 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00101.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-assert-str-equals 4 | 000013* source name: CBU00101.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*>Make equals assertion for PIC X(32000) 25 | 000047* arg1: AssertName - Assertion naome 26 | 000048* arg2: ResExpected - Value expected 27 | 000049* arg3: ResActual - value returned 28 | 000050 IDENTIFICATION DIVISION. 29 | 000060 PROGRAM-ID. CBU00101. 30 | 000083 DATA DIVISION. 31 | 000084 WORKING-STORAGE SECTION. 32 | 000085 77 str1 PIC X(32000). 33 | 000086 77 str2 PIC X(32000). 34 | 000089 77 WS-CNT1 PIC 99999. 35 | 000090 77 WS-CNT2 PIC 99999. 36 | 000091 37 | 000094 COPY CBUC0002. 38 | 000096 LINKAGE SECTION. 39 | 000098 77 ResExpected PIC X(32000). 40 | 000099 77 ResActual PIC X(32000). 41 | 000100 77 AssertName PIC X(20). 42 | 000101 COPY CBUC0001. 43 | 000102 PROCEDURE DIVISION 44 | 000103 USING CBU-ctx AssertName ResExpected ResActual. 45 | 000104 CALL CBU-add-assert-run USING CBU-ctx AssertName. 46 | 000105 47 | 000106 48 | 000107 MOVE 0 to WS-CNT1. 49 | 000109 MOVE 0 to WS-CNT2. 50 | 000110 51 | 000111* MOVE FUNCTION Reverse(ResExpected) to str1. 52 | 000112* DISPLAY "track 3.1". 53 | 000113* MOVE FUNCTION Reverse(ResActual) to str2. 54 | 000114* DISPLAY "track 4". 55 | 000115 56 | 000116* Inspect str1 Tallying WS-CNT1 For Leading space 57 | 000117* IF WS-CNT1 IS EQUAL TO 0 THEN 58 | 000118* Inspect str1 Tallying WS-CNT1 For Leading X"00" 59 | 000119* END-IF 60 | 000120 61 | 000121* Inspect str2 Tallying WS-CNT2 For Leading space 62 | 000122* IF WS-CNT2 IS EQUAL TO 0 THEN 63 | 000123* Inspect str2 Tallying WS-CNT2 For Leading X"00" 64 | 000124* END-IF 65 | 000125* Compute WS-CNT1 = length of str1 - WS-CNT1. 66 | 000126* Compute WS-CNT2 = length of str2 - WS-CNT2. 67 | 000131 68 | 000132 CALL CBU-get-last-index USING CBU-ctx ResExpected WS-CNT1 69 | 000134 CALL CBU-get-last-index USING CBU-ctx ResActual WS-CNT2 70 | 000135 71 | 000136 IF ResExpected(1:WS-CNT1)<>ResActual(1:WS-CNT2) 72 | 000137 THEN 73 | 000138 CALL CBU-log-assert-failed 74 | 000139 USING CBU-ctx 75 | 000140 AssertName 76 | 000141 ResExpected(1:WS-CNT1) 77 | 000142 ResActual(1:WS-CNT2) 78 | 000143 CALL CBU-add-assert-failed 79 | 000144 USING CBU-ctx 80 | 000145 AssertName 81 | 000146 ResExpected(1:WS-CNT1) 82 | 000147 ResActual(1:WS-CNT2) 83 | 000148 ELSE 84 | 000150 CALL CBU-add-assert-succeed 85 | 000151 USING CBU-ctx AssertName 86 | 000152 CALL CBU-log-assert-succeed 87 | 000153 USING CBU-ctx AssertName 88 | 000154 END-IF. 89 | 000155 EXIT PROGRAM. 90 | 000160 END PROGRAM CBU00101. 91 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00102.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-display-line 4 | 000013* source name: CBU00200.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*>Make equals assertion for PIC 9(3) 25 | 000047* arg1: AssertName - Assertion naome 26 | 000048* arg2: ResExpected - Value expected 27 | 000049* arg3: ResActual - value returned 28 | 000050 IDENTIFICATION DIVISION. 29 | 000060 PROGRAM-ID. CBU00102. 30 | 000093 DATA DIVISION. 31 | 000094 WORKING-STORAGE SECTION. 32 | 000096 77 CharCount3 PIC 99. 33 | 000097 77 str-res-expected PIC X(32000) VALUE SPACE. 34 | 000098 77 str-res-actual PIC X(32000) VALUE SPACE. 35 | 000099 COPY CBUC0002. 36 | 000100 LINKAGE SECTION. 37 | 000101 77 AssertName PIC X(20). 38 | 000102 77 ResExpected PIC 999. 39 | 000103 77 ResActual PIC 999. 40 | 000104 COPY CBUC0001. 41 | 000105 PROCEDURE DIVISION 42 | 000106 USING CBU-ctx AssertName ResExpected ResActual. 43 | 000108 CALL CBU-add-assert-run USING CBU-ctx AssertName. 44 | 000110 INITIALIZE str-res-expected. 45 | 000111 INITIALIZE str-res-actual. 46 | 000113 PERFORM VARYING CharCount3 FROM 19 BY -1 47 | 000114 UNTIL AssertName(CharCount3:1) <> SPACE 48 | 000115 END-PERFORM 49 | 000116 IF ResExpected <> ResActual THEN 50 | 000117 MOVE ResExpected TO str-res-expected 51 | 000118 MOVE ResActual TO str-res-actual 52 | 000120 CALL CBU-add-assert-failed 53 | 000121 USING CBU-ctx AssertName str-res-expected str-res-actual 54 | 000122 CALL CBU-log-assert-failed 55 | 000123 USING CBU-ctx AssertName str-res-expected str-res-actual 56 | 000124 ELSE 57 | 000125 CALL CBU-add-assert-succeed USING CBU-ctx AssertName 58 | 000128 CALL CBU-log-assert-succeed USING CBU-ctx AssertName 59 | 000129 END-IF. 60 | 000130 EXIT PROGRAM. 61 | 000140 END PROGRAM CBU00102. 62 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00103.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-assert-equals 4 | 000013* source name: CBU00103.cob 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046*>Make equals assertion for pointers 25 | 000047* arg1: AssertName - Assertion naome 26 | 000048* arg2: expected-p - pointer to value expected 27 | 000049* arg3: actual-p - pointer to value actual 28 | 000050 IDENTIFICATION DIVISION. 29 | 000060 PROGRAM-ID. CBU00103. 30 | 000083 DATA DIVISION. 31 | 000084 WORKING-STORAGE SECTION. 32 | 000091 33 | 000094 COPY CBUC0002. 34 | 000095 LINKAGE SECTION. 35 | 000096 01 AssertName PIC X(20). 36 | 000097 01 expected-p USAGE IS POINTER. 37 | 000098 01 actual-p USAGE IS POINTER. 38 | 000099 COPY CBUC0001. 39 | 000100 PROCEDURE DIVISION 40 | 000101 USING CBU-ctx AssertName expected-p actual-p. 41 | 000102* CALL CBU-add-assert-run USING AssertName. 42 | 000130 DISPLAY "expected-p :" expected-p. 43 | 000131 DISPLAY "actual-p :" actual-p. 44 | 000132 IF expected-p=actual-p THEN 45 | 000133 DISPLAY "EQUALITY" 46 | 000134 END-IF 47 | 000136* IF ResExpected(1:WS-CNT1)<>ResActual(1:WS-CNT2) 48 | 000137* THEN 49 | 000138* CALL CBU-add-assert-failed 50 | 000139* USING AssertName ResExpected ResActual 51 | 000140* CALL CBU-log-assert-failed 52 | 000141* USING AssertName ResExpected ResActual 53 | 000142* ELSE 54 | 000143* CALL CBU-add-assert-succeed 55 | 000144* USING AssertName 56 | 000145* CALL CBU-log-assert-succeed 57 | 000146* USING AssertName 58 | 000147* END-IF. 59 | 000148 EXIT PROGRAM. 60 | 000150 END PROGRAM CBU00103. 61 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00200.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-display-line 4 | 000013* source name: CBU00200 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046 25 | 000047*> Display on screen a line after parsing blanks 26 | 000048* arg1: line-display - line to displau 27 | 000049 IDENTIFICATION DIVISION. 28 | 000050 PROGRAM-ID. CBU00200. 29 | 000093 DATA DIVISION. 30 | 000094 WORKING-STORAGE SECTION. 31 | 000113 COPY CBUC0002. 32 | 000114 77 WS-CNT PIC 999. 33 | 000115 77 l PIC X(255). 34 | 000116 LINKAGE SECTION. 35 | 000117 01 line-display PIC X(255). 36 | 000118 COPY CBUC0001. 37 | 000122 PROCEDURE DIVISION USING CBU-ctx line-display. 38 | 000153 MOVE line-display TO l. 39 | 000154 CALL CBU-get-last-index USING CBU-ctx l WS-CNT. 40 | 000208 DISPLAY line-display(1:WS-CNT). 41 | 000220 END PROGRAM CBU00200. 42 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00300.cob: -------------------------------------------------------------------------------- 1 | 000100* COBOLUnit is a COBOL Unit framework testing 2 | 000101* 3 | 000102* Logic name: CBU-display-suite 4 | 000103* source name: CBU-display-suite.cob 5 | 000113* 6 | 000119* Copyright (C) 2009 Hervé Vaujour 7 | 000120* 8 | 000121* This program is free software; you can redistribute it and/or modify 9 | 000122* it under the terms of the GNU General Public License as published by 10 | 000123* the Free Software Foundation; either version 2 of the License, or 11 | 000124* (at your option) any later version. 12 | 000125* 13 | 000126* This program is distributed in the hope that it will be useful, 14 | 000127* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000128* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000129* GNU General Public License for more details. 17 | 000130* 18 | 000131* You should have received a copy of the GNU General Public License 19 | 000132* along with this program; see the file COPYING. If not, write to the 20 | 000133* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000134 22 | 000135************* CBU_DISPLAY_SUITE ************ 23 | 000136 IDENTIFICATION DIVISION. 24 | 000137 PROGRAM-ID. CBU00300. 25 | 000138 DATA DIVISION. 26 | 000140 WORKING-STORAGE SECTION. 27 | 000150 COPY CBUC0002. 28 | 000210 01 MaSuite. 29 | 000212 10 SuiteN PIC X(20). 30 | 000213 10 SuiteD PIC X(50). 31 | 000214 10 suite-s PIC 9(2). 32 | 000215 10 nb-test-siz PIC 9(3). 33 | 000216 10 nb-test-ru PIC 9(3). 34 | 000217 10 nb-test-suc PIC 9(3). 35 | 000218 10 nb-test-fail PIC 9(3). 36 | 000219 10 nb-test-err PIC 9(3). 37 | 000220 01 MonTest. 38 | 000221 10 TestN PIC X(20). 39 | 000222 10 TestD PIC X(50). 40 | 000223 10 nb-assert-ru PIC 9(3). 41 | 000224 10 nb-assert-suc PIC 9(3). 42 | 000225 10 nb-assert-fail PIC 9(3). 43 | 000226 44 | 000227 01 MonAssert. 45 | 000228 10 AssertRunN PIC X(20). 46 | 000229 10 has-succ PIC 9(1). 47 | 000230 10 AssertValueExp PIC X(255). 48 | 000231 10 AssertValueAct PIC X(255). 49 | 000232 01 i PIC 9(2). 50 | 000240 01 j PIC 9(2). 51 | 000250 01 k PIC 9(2). 52 | 000260 01 WS-CNT1 PIC 999. 53 | 000270 01 WS-CNT2 PIC 999. 54 | 000272 55 | 000273 LINKAGE SECTION. 56 | 000274 COPY CBUC0001. 57 | 000275 58 | 000276 PROCEDURE DIVISION USING CBU-ctx. 59 | 000281 PERFORM VARYING i FROM 1 BY 1 60 | 000290 UNTIL i >= SuiteIndex 61 | 000300 MOVE ListeSuites(i) TO MaSuite 62 | 000310 DISPLAY "i="i 63 | 000320 DISPLAY "Suite: " SuiteN 64 | 000330 DISPLAY "Description: " SuiteD 65 | 000340 DISPLAY "suite-size: " suite-s 66 | 000341 DISPLAY "nb-test-size: " nb-test-siz 67 | 000342 DISPLAY "nb-test-run:" nb-test-ru 68 | 000343 DISPLAY "nb-test-succeed: "nb-test-suc 69 | 000344 DISPLAY "nb-test-failed: " nb-test-fail 70 | 000345 DISPLAY "nb-test-err: " nb-test-err 71 | 000346 72 | 000347 PERFORM VARYING j FROM 1 BY 1 73 | 000350 UNTIL j> nb-test-siz 74 | 000360 MOVE ListeTests(i,j) TO MonTest 75 | 000361 DISPLAY "test size = " nb-test-siz 76 | 000370 DISPLAY "j="j 77 | 000380 DISPLAY "----- TestName: " TestN 78 | 000390 DISPLAY "----- TestDesc: " TestD 79 | 000400 DISPLAY "----- Test assert run: " 80 | 000401 nb-assert-ru 81 | 000402 DISPLAY "----- Test assert succeed: " 82 | 000403 nb-assert-suc 83 | 000404 DISPLAY "----- Test assert failed: " 84 | 000405 nb-assert-fail 85 | 000406* PERFORM VARYING k FROM 1 BY 1 86 | 000407* UNTIL k> nb-assert-ru 87 | 000408* DISPLAY "k= " k 88 | 000409* MOVE ListeAssertRuns(i,j,k) TO MonAssert 89 | 000410* CALL CBU-get-last-index 90 | 000411* USING CBU-ctx AssertValueExp WS-CNT1 91 | 000412* CALL CBU-get-last-index 92 | 000413* USING CBU-ctx AssertValueAct WS-CNT2 93 | 000414* DISPLAY "----------- AssertName: " 94 | 000415* AssertRunN 95 | 000416* DISPLAY "----------- has succeed: " 96 | 000417* has-succ 97 | 000418* DISPLAY "----------- expected: " 98 | 000419* AssertValueExp(1:WS-CNT1) 99 | 000420* DISPLAY "----------- actual: " 100 | 000421* AssertValueAct(1:WS-CNT2) 101 | 000422* END-PERFORM 102 | 000423 DISPLAY "********" 103 | 000424 END-PERFORM 104 | 000425 END-PERFORM. 105 | 000430 106 | 000440 EXIT PROGRAM. 107 | 000450 END PROGRAM CBU00300. 108 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU00301.cob: -------------------------------------------------------------------------------- 1 | 000100* COBOLUnit is a COBOL Unit framework testing 2 | 000101* 3 | 000102* Logic name: CBU-display-res 4 | 000103* source name: CBU00301.cob 5 | 000113* 6 | 000118* Copyright (C) 2009 Hervé Vaujour 7 | 000119* 8 | 000120* This program is free software; you can redistribute it and/or modify 9 | 000121* it under the terms of the GNU General Public License as published by 10 | 000122* the Free Software Foundation; either version 2 of the License, or 11 | 000123* (at your option) any later version. 12 | 000124* 13 | 000125* This program is distributed in the hope that it will be useful, 14 | 000126* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000127* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000128* GNU General Public License for more details. 17 | 000129* 18 | 000130* You should have received a copy of the GNU General Public License 19 | 000131* along with this program; see the file COPYING. If not, write to the 20 | 000132* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000133 22 | 000134 23 | 000135************* CBU_DISPLAY_RES ************ 24 | 000136 IDENTIFICATION DIVISION. 25 | 000137 PROGRAM-ID. CBU00301. 26 | 000138 DATA DIVISION. 27 | 000140 WORKING-STORAGE SECTION. 28 | 000150 COPY CBUC0002. 29 | 000210 01 MaSuite. 30 | 000212 10 SuiteN PIC X(20). 31 | 000213 10 SuiteD PIC X(50). 32 | 000214 10 suite-s PIC 9(2). 33 | 000215 10 nb-test-siz PIC 9(3). 34 | 000216 10 nb-test-ru PIC 9(3). 35 | 000217 10 nb-test-suc PIC 9(3). 36 | 000218 10 nb-test-fail PIC 9(3). 37 | 000219 10 nb-test-err PIC 9(3). 38 | 000220 01 MonTest. 39 | 000221 10 TestN PIC X(20). 40 | 000222 10 TestD PIC X(50). 41 | 000223 10 nb-assert-ru PIC 9(3). 42 | 000224 10 nb-assert-suc PIC 9(3). 43 | 000225 10 nb-assert-fail PIC 9(3). 44 | 000226 45 | 000227 01 MonAssert. 46 | 000228 10 AssertRunN PIC X(20). 47 | 000229 10 has-succ PIC 9(1). 48 | 000230 10 AssertValueExp PIC X(255). 49 | 000231 10 AssertValueAct PIC X(255). 50 | 000232 01 i PIC 9(2). 51 | 000240 01 j PIC 9(2). 52 | 000250 01 k PIC 9(2). 53 | 000251 01 str PIC X(255). 54 | 000260 01 WS-CNT1 PIC 999. 55 | 000270 01 WS-CNT2 PIC 999. 56 | 000271 57 | 000272 LINKAGE SECTION. 58 | 000273 COPY CBUC0001. 59 | 000274 60 | 000275 61 | 000276 PROCEDURE DIVISION USING CBU-ctx. 62 | 000281 PERFORM VARYING i FROM 1 BY 1 63 | 000290 UNTIL i >= SuiteIndex 64 | 000300 MOVE ListeSuites(i) TO MaSuite 65 | 000310 66 | 000311 INITIALIZE str 67 | 000312 MOVE SuiteN TO str 68 | 000313 CALL CBU-get-last-index 69 | 000314 USING CBU-ctx str WS-CNT1 70 | 000315 DISPLAY "Suite '" str(1:WS-CNT1) 71 | 000316 " running..." 72 | 000317 DISPLAY " "nb-test-ru " tests run [" 73 | 000318 "("nb-test-suc") succeed," 74 | 000319 "("nb-test-fail") failed]" 75 | 000320 76 | 000321 IF nb-test-fail <> 0 AND 77 | 000322 nb-test-err <> 0 THEN 78 | 000323 DISPLAY "..... SUCCEED!" 79 | 000324 ELSE 80 | 000325 DISPLAY "..... SUCCEED!" 81 | 000326 82 | 000333 END-IF 83 | 000334 84 | 000335 85 | 000336* DISPLAY "Suite '" SuiteN "' Failed..." 86 | 000337* DISPLAY "i="i 87 | 000338* DISPLAY "Suite: " SuiteN 88 | 000339* DISPLAY "Description: " SuiteD 89 | 000340* DISPLAY "suite-size: " suite-s 90 | 000341* DISPLAY "nb-test-size: " nb-test-siz 91 | 000342* DISPLAY "nb-test-run:" nb-test-ru 92 | 000343 DISPLAY "nb-test-succeed: "nb-test-suc 93 | 000344 DISPLAY "nb-test-failed: " nb-test-fail 94 | 000345 DISPLAY "nb-test-err: " nb-test-err 95 | 000346 96 | 000347 PERFORM VARYING j FROM 1 BY 1 97 | 000350 UNTIL j> nb-test-siz 98 | 000360 MOVE ListeTests(i,j) TO MonTest 99 | 000361* DISPLAY "test size = " nb-test-siz 100 | 000370* DISPLAY "j="j 101 | 000380* DISPLAY "----- TestName: " TestN 102 | 000390* DISPLAY "----- TestDesc: " TestD 103 | 000400* DISPLAY "----- Test assert run: " nb-assert-ru 104 | 000401* DISPLAY "----- Test assert succeed: " nb-assert-suc 105 | 000402* DISPLAY "----- Test assert failed: " nb-assert-fail 106 | 000404 PERFORM VARYING k FROM 1 BY 1 107 | 000405 UNTIL k> nb-assert-ru 108 | 000406* DISPLAY "k= " k 109 | 000407* MOVE ListeAssertRuns(i,j,k) TO MonAssert 110 | 000408* CALL CBU-get-last-index 111 | 000409* USING AssertValueExp WS-CNT1 112 | 000410* CALL CBU-get-last-index 113 | 000411* USING AssertValueAct WS-CNT2 114 | 000413* DISPLAY "----------- AssertName: " 115 | 000414* AssertRunN 116 | 000415* DISPLAY "----------- has succeed: " 117 | 000416* has-succ 118 | 000417* DISPLAY "----------- expected: " 119 | 000418* AssertValueExp(1:WS-CNT1) 120 | 000419* DISPLAY "----------- actual: " 121 | 000420* AssertValueAct(1:WS-CNT2) 122 | 000421 END-PERFORM 123 | 000422 DISPLAY "********" 124 | 000423 END-PERFORM 125 | 000424 END-PERFORM. 126 | 000430 127 | 000440 EXIT PROGRAM. 128 | 000450 END PROGRAM CBU00301. 129 | -------------------------------------------------------------------------------- /COBOLUnitLib/CBU0U001.cob: -------------------------------------------------------------------------------- 1 | 000010* COBOLUnit is a COBOL Unit framework testing 2 | 000011* 3 | 000012* Logic name: CBU-get-last-index 4 | 000013* source name: CBU-U001 5 | 000023* 6 | 000028* Copyright (C) 2009 Hervé Vaujour 7 | 000029* 8 | 000030* This program is free software; you can redistribute it and/or modify 9 | 000031* it under the terms of the GNU General Public License as published by 10 | 000032* the Free Software Foundation; either version 2 of the License, or 11 | 000033* (at your option) any later version. 12 | 000034* 13 | 000035* This program is distributed in the hope that it will be useful, 14 | 000036* but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | 000037* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | 000038* GNU General Public License for more details. 17 | 000039* 18 | 000040* You should have received a copy of the GNU General Public License 19 | 000041* along with this program; see the file COPYING. If not, write to the 20 | 000042* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | 000043 22 | 000044 23 | 000045 24 | 000046 25 | 000047*> Return last index in a string to parse it 26 | 000048* arg1: line-to-parse - line to parse 27 | 000049* arg2: index - index of 28 | 000050 IDENTIFICATION DIVISION. 29 | 000060 PROGRAM-ID. CBU-U001. 30 | 000093 DATA DIVISION. 31 | 000094 WORKING-STORAGE SECTION. 32 | 000104 77 str1 PIC X(32000). 33 | 000105 COPY CBUC0002. 34 | 000113 35 | 000114 LINKAGE SECTION. 36 | 000115 77 line-to-parse PIC X(32000). 37 | 000116 77 WS-CNT1 PIC 99999. 38 | 000117 COPY CBUC0001. 39 | 000122 PROCEDURE DIVISION USING CBU-ctx line-to-parse WS-CNT1. 40 | 000147 MOVE 0 TO WS-CNT1. 41 | 000150 INITIALIZE str1. 42 | 000151 MOVE FUNCTION Reverse(line-to-parse) to str1. 43 | 000152 Inspect str1 Tallying WS-CNT1 For Leading space. 44 | 000153 IF WS-CNT1 IS EQUAL TO 0 THEN 45 | 000154 Inspect str1 Tallying WS-CNT1 For Leading X"00" 46 | 000155 END-IF. 47 | 000162 Compute WS-CNT1 = length of str1 - WS-CNT1. 48 | 000230 END PROGRAM CBU-U001. 49 | -------------------------------------------------------------------------------- /COBOLUnitLib/COPY/CBUC0001.cob: -------------------------------------------------------------------------------- 1 | 000320* COBOLUnit is a COBOL Unit framework testing 2 | 000321* 3 | 000322* source name: CBUC0001.cob 4 | 000323* 5 | 000338* Copyright (C) 2009 Hervé Vaujour 6 | 000339* 7 | 000340* This program is free software; you can redistribute it and/or modify 8 | 000341* it under the terms of the GNU General Public License as published by 9 | 000342* the Free Software Foundation; either version 2 of the License, or 10 | 000343* (at your option) any later version. 11 | 000344* 12 | 000345* This program is distributed in the hope that it will be useful, 13 | 000346* but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | 000347* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | 000348* GNU General Public License for more details. 16 | 000349* 17 | 000350* You should have received a copy of the GNU General Public License 18 | 000351* along with this program; see the file COPYING. If not, write to the 19 | 000352* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | 000353 21 | 000354 22 | 000359 23 | 000360 01 CBU-ctx. 24 | 000366 02 TestError PIC 9(3) . 25 | 000367 02 TestIsRunning PIC 9(1) . 26 | 000368 02 TestLog PIC X(100) . 27 | 000369 02 RunFailureCount PIC 9(3) . 28 | 000370 02 RunSuccessCount PIC 9(3) . 29 | 000371 02 TestRunCount PIC 9(3) . 30 | 000372 02 TestSetupCount PIC 9(3) . 31 | 000380 02 AssertFailureCount PIC 9(3) . 32 | 000388 02 AssertTestCount PIC 9(3) . 33 | 000390 02 use-log-file PIC 9 . 34 | 000392 02 nb-suite-run PIC 9(3). 35 | 000393 02 CarRetourChariot PIC X(1). 36 | 000394 02 LogLineLength PIC 9(5) . 37 | 000395 02 index-current-suite PIC 99 . 38 | 000396 02 index-current-test PIC 99 . 39 | 000397* 02 index-current-assert PIC 99 . 40 | 000398 02 name-current-suite PIC X(20) . 41 | 000399 02 name-current-test PIC X(20) . 42 | 000400 02 currentLogFile PIC X(24) . 43 | 000401 02 SuiteIndex PIC 9(2) . 44 | 000402 02 TestIndex PIC 9(2) . 45 | 000403 02 AssertIndex PIC 9(2). 46 | 000404 47 | 000405 02 log-entete-test PIC X(16). 48 | 000406 02 log-asserts-res PIC X(32000). 49 | 000407 02 log-fin-test PIC X(55). 50 | 000408 02 log-entete-suite PIC X(30). 51 | 000410 02 log-fin-suite PIC X(55). 52 | 000411 53 | 000412 02 SuiteTests. 54 | 000413 05 ListeSuites OCCURS 50 . 55 | 000414 10 SuiteName PIC X(20). 56 | 000415 10 SuiteDesc PIC X(50). 57 | 000416 10 suite-size PIC 9(2). 58 | 000417 10 nb-test-size PIC 9(3). 59 | 000418 10 nb-test-run PIC 9(3). 60 | 000419 10 nb-test-succeed PIC 9(3). 61 | 000420 10 nb-test-failed PIC 9(3). 62 | 000421 10 nb-test-error PIC 9(3). 63 | 000422 10 ListeTests OCCURS 100 TIMES. 64 | 000423 30 TestName PIC X(20). 65 | 000424 30 TestDesc PIC X(50). 66 | 000425 30 nb-assert-run PIC 9(3). 67 | 000426 30 nb-assert-succeed PIC 9(3). 68 | 000427 30 nb-assert-failed PIC 9(3). 69 | 000428* 30 ListeAssertRuns OCCURS 20 TIMES. 70 | 000429* 40 AssertRunName PIC X(20). 71 | 000430* 40 has-succeed PIC 9(1). 72 | 000431* 40 AssertValueExpected PIC X(255). 73 | 000432* 40 AssertValueActual PIC X(255). 74 | 000433 75 | 000442 76 | 000452 77 | 000462* routines name 78 | 000463* 0-100: core routine 79 | 000464* 80 | 000562 81 | 000572 82 | -------------------------------------------------------------------------------- /COBOLUnitLib/COPY/CBUC0002.cob: -------------------------------------------------------------------------------- 1 | 000010 2 | 000011 01 CBU-reset-run PIC X(8) 3 | 000012 VALUE "CBU00000". 4 | 000013 01 CBU-initialize PIC X(8) 5 | 000014 VALUE "CBU00001". 6 | 000015 01 CBU-call-test PIC X(8) 7 | 000016 VALUE "CBU00002". 8 | 000017 01 CBU-run PIC X(8) 9 | 000018 VALUE "CBU00003". 10 | 000019 01 CBU-add-suite PIC X(8) 11 | 000020 VALUE "CBU00004". 12 | 000021 01 CBU-add-test PIC X(8) 13 | 000022 VALUE "CBU00005". 14 | 000023 01 CBU-suites-run PIC X(8) 15 | 000024 VALUE "CBU00006". 16 | 000025 01 CBU-suite-run PIC X(8) 17 | 000026 VALUE "CBU00007". 18 | 000027 01 CBU-tests-run PIC X(8) 19 | 000028 VALUE "CBU00008". 20 | 000029 01 CBU-test-run PIC X(8) 21 | 000030 VALUE "CBU00009". 22 | 000031 01 CBU-set-log-file PIC X(8) 23 | 000032 VALUE "CBU00011". 24 | 000033 01 CBU-add-test-next PIC X(8) 25 | 000034 VALUE "CBU00012". 26 | 000035 01 CBU-add-assert-succeed PIC X(8) 27 | 000036 VALUE "CBU00020". 28 | 000037 01 CBU-add-assert-run PIC X(8) 29 | 000038 VALUE "CBU00025". 30 | 000039 01 CBU-add-assert-failed PIC X(8) 31 | 000040 VALUE "CBU00030". 32 | 000041 01 CBU-add-error PIC X(8) 33 | 000042 VALUE "CBU00040". 34 | 000043 01 CBU-log-assert-succeed PIC X(8) 35 | 000044 VALUE "CBU00050". 36 | 000045 01 CBU-log-assert-failed PIC X(8) 37 | 000046 VALUE "CBU00060". 38 | 000047 01 CBU-write-log-line PIC X(8) 39 | 000048 VALUE "CBU00080". 40 | 000049 01 CBU-assert-str100-equals PIC X(8) 41 | 000050 VALUE "CBU00100". 42 | 000051 01 CBU-assert-str-equals PIC X(8) 43 | 000052 VALUE "CBU00101". 44 | 000053 01 CBU-assert-nb3-equals PIC X(8) 45 | 000054 VALUE "CBU00102". 46 | 000055 01 CBU-display-line PIC X(8) 47 | 000056 VALUE "CBU00200". 48 | 000057 01 CBU-display-suite PIC X(8) 49 | 000058 VALUE "CBU00300". 50 | 000059 01 CBU-display-res PIC X(8) 51 | 000060 VALUE "CBU00301". 52 | 000061 01 CBU-assert-equals PIC X(8) 53 | 000062 VALUE "CBU00103". 54 | 000063 55 | 000064 01 CBU-get-last-index PIC X(8) 56 | 000065 VALUE "CBU-U001". 57 | -------------------------------------------------------------------------------- /COBOLUnitLib/COPYING.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | 167 | -------------------------------------------------------------------------------- /COBOLUnitLib/Makefile: -------------------------------------------------------------------------------- 1 | CBU_PATH?=$(shell pwd) 2 | CBU_LIB_PATH=$(CBU_PATH)/lib 3 | CBU_COPY_PATH=$(CBU_PATH)/COPY 4 | 5 | all: clean dirs CobolUnit 6 | 7 | CobolUnit: 8 | cobc -c -I $(CBU_COPY_PATH) -b CBU00000.cob CBU00001.cob CBU00002.cob CBU00003.cob CBU00004.cob CBU00005.cob CBU00006.cob CBU00007.cob CBU00008.cob CBU00009.cob CBU00011.cob CBU00012.cob CBU00020.cob CBU00025.cob CBU00050.cob CBU00060.cob CBU00030.cob CBU00040.cob CBU00080.cob CBU00100.cob CBU00101.cob CBU00102.cob CBU00103.cob CBU00200.cob CBU00300.cob CBU00301.cob CBU0U001.cob 9 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -o libCobolUnit.dylib *.o 10 | mv *.dylib $(CBU_LIB_PATH) 11 | 12 | dirs: 13 | mkdir $(CBU_LIB_PATH) 14 | 15 | clean: 16 | rm -f *.c *.h *.o *.s 17 | rm -rf *.so *.dylib 18 | rm -rf $(CBU_LIB_PATH) 19 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Makefile: -------------------------------------------------------------------------------- 1 | CBU_SAMPLE1=Sample1 2 | CBU_SAMPLE2=Sample2 3 | CBU_SAMPLE3=Sample3 4 | 5 | all: 6 | $(MAKE) -C $(CBU_SAMPLE1) 7 | $(MAKE) -C $(CBU_SAMPLE2) 8 | $(MAKE) -C $(CBU_SAMPLE3) 9 | 10 | clean: 11 | $(MAKE) -C $(CBU_SAMPLE1) clean 12 | $(MAKE) -C $(CBU_SAMPLE2) clean 13 | $(MAKE) -C $(CBU_SAMPLE3) clean 14 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample1/COPY/SAMPC001.cob: -------------------------------------------------------------------------------- 1 | 000010 01 SAMPLE01 PIC X(8) 2 | 000020 VALUE "SAMPLE01". 3 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample1/Makefile: -------------------------------------------------------------------------------- 1 | CBU_PATH?=$(shell pwd)/../../COBOLUnitLib 2 | CBU_LIB_PATH=$(CBU_PATH)/lib 3 | CBU_COPY_PATH=$(CBU_PATH)/COPY 4 | 5 | SAMPLE_PATH=$(shell pwd) 6 | SAMPLE_LIB_PATH=$(SAMPLE_PATH)/lib 7 | SAMPLE_COPY_PATH=$(SAMPLE_PATH)/COPY 8 | SAMPLE_TESTS_PATH=$(SAMPLE_PATH)/tests 9 | SAMPLE_TESTS_LIB_PATH=$(SAMPLE_PATH)/tests/lib 10 | 11 | all: clean dirs SAMPLE01 TS000001 SUITE001 test 12 | 13 | SAMPLE01: 14 | cobc -c SAMPLE01.cob 15 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -o libSample1.dylib SAMPLE01.o 16 | mv libSample1.dylib $(SAMPLE_LIB_PATH) 17 | 18 | TS000001: 19 | cobc -c -I $(CBU_COPY_PATH) -I $(SAMPLE_COPY_PATH) TS000001.cob 20 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -L $(SAMPLE_LIB_PATH) -l Sample1 -o libTS1.dylib TS000001.o 21 | mv libTS1.dylib $(SAMPLE_TESTS_LIB_PATH) 22 | 23 | SUITE001: 24 | cobc -x -o SUITE001 -I $(CBU_COPY_PATH) -I $(SAMPLE_COPY_PATH) -L $(CBU_LIB_PATH) -l CobolUnit -L $(SAMPLE_TESTS_LIB_PATH) -l TS1 SUITE001.cob 25 | mv SUITE001 $(SAMPLE_TESTS_PATH) 26 | 27 | test: 28 | ln -s $(CBU_LIB_PATH)/libCobolUnit.dylib $(SAMPLE_TESTS_PATH) 29 | ln -s $(SAMPLE_LIB_PATH)/libSample1.dylib $(SAMPLE_TESTS_PATH) 30 | ln -s $(SAMPLE_TESTS_LIB_PATH)/libTS1.dylib $(SAMPLE_TESTS_PATH) 31 | (cd $(SAMPLE_TESTS_PATH) && ./SUITE001) 32 | 33 | dirs: 34 | mkdir $(SAMPLE_LIB_PATH) 35 | mkdir $(SAMPLE_TESTS_PATH) 36 | mkdir $(SAMPLE_TESTS_LIB_PATH) 37 | 38 | clean: 39 | rm -f *.c *.h *.o *.s 40 | rm -rf *.so *.dylib 41 | rm -rf $(SAMPLE_TESTS_LIB_PATH) 42 | rm -rf $(SAMPLE_TESTS_PATH) 43 | rm -rf $(SAMPLE_LIB_PATH) 44 | 45 | 46 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample1/SAMPLE01.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SAMPLE01. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000071 LINKAGE SECTION. 9 | 000072 01 A PIC 99. 10 | 000073 01 B PIC 99. 11 | 000074 01 RES PIC 99. 12 | 000080 PROCEDURE DIVISION USING A B RES. 13 | 000081 IF A > B THEN 14 | 000082 MOVE 1 TO RES 15 | 000083 ELSE 16 | 000084* IF A=B THEN 17 | 000085* MOVE 2 TO RES 18 | 000086* ELSE 19 | 000087 MOVE 0 TO RES 20 | 000088* END-IF 21 | 000094 END-IF. 22 | 000100 END PROGRAM SAMPLE01. 23 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample1/SUITE001.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SUITE001. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000090 COPY CBUC0001. 9 | 000091 COPY CBUC0002. 10 | 000092 01 str1 PIC X(20). 11 | 000093 01 str2 PIC X(100). 12 | 000094 01 RES PIC 99. 13 | 000095 PROCEDURE DIVISION. 14 | 000096 INITIALIZE str1 str2. 15 | 000097 MOVE "SUITE1" TO str1. 16 | 000098 MOVE "DESC SUITE1" TO str2. 17 | 000099 CALL CBU-initialize USING CBU-ctx. 18 | 000102 CALL CBU-add-suite USING CBU-ctx str1 str2. 19 | 000103 20 | 000104 INITIALIZE str1 str2. 21 | 000105 MOVE "TS000001" TO str1. 22 | 000106 MOVE "TEST1 desc" TO str2. 23 | 000108 CALL CBU-add-test-next USING CBU-ctx str1 str2. 24 | 000109 25 | 000121 CALL CBU-run USING CBU-ctx. 26 | 000130 END PROGRAM SUITE001. 27 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample1/TS000001.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. TS000001. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000072 COPY CBUC0002. 9 | 000073 COPY SAMPC001. 10 | 000080 01 A PIC 99. 11 | 000081 01 B PIC 99. 12 | 000082 01 RES PIC 99. 13 | 000083 01 EXPECTED PIC 99. 14 | 000084 01 assert-name PIC X(20). 15 | 000085 LINKAGE SECTION. 16 | 000086 COPY CBUC0001. 17 | 000087 PROCEDURE DIVISION USING CBU-ctx. 18 | 000100 MOVE 1 TO EXPECTED. 19 | 000110 MOVE 3 TO A. 20 | 000120 MOVE 2 TO B. 21 | 000130 CALL SAMPLE01 USING A B RES. 22 | 000140 MOVE "SAMPLE01(3,2)=1" TO assert-name. 23 | 000150 CALL CBU-assert-nb3-equals 24 | 000160 USING CBU-ctx assert-name EXPECTED RES. 25 | 000170* MOVE 2 TO EXPECTED. 26 | 000180* MOVE 2 TO A. 27 | 000190* MOVE 2 TO B. 28 | 000200* CALL "SAMPLE01" USING A B RES. 29 | 000210* MOVE "SAMPLE01(2,2)=2" TO assert-name. 30 | 000220* CALL CBU-assert-nb3-equals 31 | 000230* USING CBU-ctx assert-name EXPECTED RES. 32 | 000240* MOVE 2 TO EXPECTED. 33 | 000250* MOVE 3 TO A. 34 | 000260* MOVE 3 TO B. 35 | 000270* CALL "SAMPLE01" USING A B RES. 36 | 000280* MOVE "SAMPLE01(3,3)=2" TO assert-name. 37 | 000290* CALL CBU-assert-nb3-equals 38 | 000300* USING CBU-ctx assert-name EXPECTED RES. 39 | 000310 END PROGRAM TS000001. 40 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample2/COPY/SAMPC002.cob: -------------------------------------------------------------------------------- 1 | 000010 01 SAMPLE02 PIC X(8) 2 | 000020 VALUE "SAMPLE02". 3 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample2/Makefile: -------------------------------------------------------------------------------- 1 | CBU_PATH?=$(shell pwd)/../../COBOLUnitLib 2 | CBU_LIB_PATH=$(CBU_PATH)/lib 3 | CBU_COPY_PATH=$(CBU_PATH)/COPY 4 | 5 | SAMPLE_PATH=$(shell pwd) 6 | SAMPLE_LIB_PATH=$(SAMPLE_PATH)/lib 7 | SAMPLE_COPY_PATH=$(SAMPLE_PATH)/COPY 8 | SAMPLE_TESTS_PATH=$(SAMPLE_PATH)/tests 9 | SAMPLE_TESTS_LIB_PATH=$(SAMPLE_PATH)/tests/lib 10 | SAMPLE1_PATH=$(shell pwd)/../Sample1 11 | SAMPLE1_LIB_PATH=$(SAMPLE1_PATH)/lib 12 | SAMPLE1_COPY_PATH=$(SAMPLE1_PATH)/COPY 13 | SAMPLE1_TESTS_LIB_PATH=$(SAMPLE1_PATH)/tests/lib 14 | 15 | all: clean dirs SAMPLE02 TS000002 SUITE002 test 16 | 17 | SAMPLE02: 18 | cobc -c -I $(SAMPLE1_COPY_PATH) SAMPLE02.cob 19 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -o libSample2.dylib SAMPLE02.o 20 | mv libSample2.dylib $(SAMPLE_LIB_PATH) 21 | 22 | TS000002: 23 | cobc -c -I $(CBU_COPY_PATH) -I $(SAMPLE_COPY_PATH) TS000002.cob 24 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -L $(SAMPLE_LIB_PATH) -l Sample2 -o libTS2.dylib TS000002.o 25 | mv libTS2.dylib $(SAMPLE_TESTS_LIB_PATH) 26 | 27 | SUITE002: 28 | cobc -x -o SUITE002 -I $(CBU_COPY_PATH) -L $(CBU_LIB_PATH) -l CobolUnit -L $(SAMPLE_TESTS_LIB_PATH) -l TS2 -L $(SAMPLE1_TESTS_LIB_PATH) -l TS1 SUITE002.cob 29 | mv SUITE002 $(SAMPLE_TESTS_PATH) 30 | 31 | test: 32 | ln -s $(CBU_LIB_PATH)/libCobolUnit.dylib $(SAMPLE_TESTS_PATH) 33 | ln -s $(SAMPLE_LIB_PATH)/libSample2.dylib $(SAMPLE_TESTS_PATH) 34 | ln -s $(SAMPLE_TESTS_LIB_PATH)/libTS2.dylib $(SAMPLE_TESTS_PATH) 35 | ln -s $(SAMPLE1_LIB_PATH)/libSample1.dylib $(SAMPLE_TESTS_PATH) 36 | ln -s $(SAMPLE1_TESTS_LIB_PATH)/libTS1.dylib $(SAMPLE_TESTS_PATH) 37 | (cd $(SAMPLE_TESTS_PATH) && ./SUITE002) 38 | 39 | dirs: 40 | mkdir $(SAMPLE_LIB_PATH) 41 | mkdir $(SAMPLE_TESTS_PATH) 42 | mkdir $(SAMPLE_TESTS_LIB_PATH) 43 | 44 | clean: 45 | rm -f *.c *.h *.o *.s 46 | rm -rf *.so *.dylib 47 | rm -rf $(SAMPLE_TESTS_LIB_PATH) 48 | rm -rf $(SAMPLE_TESTS_PATH) 49 | rm -rf $(SAMPLE_LIB_PATH) 50 | 51 | 52 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample2/SAMPLE02.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SAMPLE02. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000071 01 D PIC 99. 9 | 000072 COPY SAMPC001. 10 | 000073 LINKAGE SECTION. 11 | 000074 01 A PIC 99. 12 | 000075 01 B PIC 99. 13 | 000076 01 C PIC 99. 14 | 000077 01 RES PIC 99. 15 | 000080 PROCEDURE DIVISION USING A B C RES. 16 | 000083 CALL SAMPLE01 USING A B D. 17 | 000093 COMPUTE RES = D * C. 18 | 000094 END PROGRAM SAMPLE02. 19 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample2/SUITE002.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SUITE002. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000091 COPY CBUC0002. 9 | 000092 COPY CBUC0001. 10 | 000093 01 str1 PIC X(20). 11 | 000094 01 str2 PIC X(100). 12 | 000095 01 RES PIC 99. 13 | 000097 PROCEDURE DIVISION . 14 | 000098 INITIALIZE str1 str2. 15 | 000099 MOVE "SUITE2" TO str1. 16 | 000100 MOVE "DESC SUITE2" TO str2. 17 | 000101 CALL CBU-initialize USING CBU-ctx. 18 | 000102 CALL CBU-add-suite USING CBU-ctx str1 str2. 19 | 000108 20 | 000109 21 | 000110 INITIALIZE str1 str2. 22 | 000111 MOVE "TS000002" TO str1. 23 | 000112 MOVE "TEST2 desc" TO str2. 24 | 000114 CALL CBU-add-test-next USING CBU-ctx str1 str2. 25 | 000120 26 | 000121 CALL CBU-run USING CBU-ctx. 27 | 000130 END PROGRAM SUITE002. 28 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample2/TS000002.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. TS000002. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000080 COPY CBUC0002. 9 | 000081 COPY SAMPC002. 10 | 000082 01 A PIC 99. 11 | 000083 01 B PIC 99. 12 | 000084 01 C PIC 99. 13 | 000085 01 RES PIC 99. 14 | 000086 01 EXPECTED PIC 99. 15 | 000087 01 assert-name PIC X(20). 16 | 000088 LINKAGE SECTION. 17 | 000089 COPY CBUC0001. 18 | 000090 PROCEDURE DIVISION USING CBU-ctx. 19 | 000091 MOVE 5 TO EXPECTED. 20 | 000092 MOVE 5 TO A. 21 | 000093 MOVE 2 TO B. 22 | 000094 MOVE 5 TO C. 23 | 000095 INITIALIZE assert-name. 24 | 000096 CALL SAMPLE02 USING A B C RES. 25 | 000097 MOVE "(5,2,5)=5" TO assert-name. 26 | 000098 CALL CBU-assert-nb3-equals 27 | 000099 USING CBU-ctx assert-name EXPECTED RES. 28 | 000100 END PROGRAM TS000002. 29 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample3/COPY/SAMPC003.cob: -------------------------------------------------------------------------------- 1 | 000010 01 SAMPLE03 PIC X(8) 2 | 000020 VALUE "SAMPLE03". 3 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample3/Makefile: -------------------------------------------------------------------------------- 1 | CBU_PATH?=$(shell pwd)/../../COBOLUnitLib 2 | CBU_LIB_PATH=$(CBU_PATH)/lib 3 | CBU_COPY_PATH=$(CBU_PATH)/COPY 4 | 5 | SAMPLE_PATH=$(shell pwd) 6 | SAMPLE_LIB_PATH=$(SAMPLE_PATH)/lib 7 | SAMPLE_COPY_PATH=$(SAMPLE_PATH)/COPY 8 | SAMPLE_TESTS_PATH=$(SAMPLE_PATH)/tests 9 | SAMPLE_TESTS_LIB_PATH=$(SAMPLE_PATH)/tests/lib 10 | SAMPLE1_PATH=$(shell pwd)/../Sample1 11 | SAMPLE1_LIB_PATH=$(SAMPLE1_PATH)/lib 12 | SAMPLE1_COPY_PATH=$(SAMPLE1_PATH)/COPY 13 | SAMPLE1_TESTS_LIB_PATH=$(SAMPLE1_PATH)/tests/lib 14 | SAMPLE2_PATH=$(shell pwd)/../Sample2 15 | SAMPLE2_LIB_PATH=$(SAMPLE2_PATH)/lib 16 | SAMPLE2_COPY_PATH=$(SAMPLE2_PATH)/COPY 17 | SAMPLE2_TESTS_LIB_PATH=$(SAMPLE2_PATH)/tests/lib 18 | 19 | all: clean dirs SAMPLE03 TS000003 SUITE003 test 20 | 21 | SAMPLE03: 22 | cobc -c -I $(SAMPLE1_COPY_PATH) -I $(SAMPLE2_COPY_PATH) SAMPLE03.cob 23 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -o libSample3.dylib SAMPLE03.o 24 | mv libSample3.dylib $(SAMPLE_LIB_PATH) 25 | 26 | TS000003: 27 | cobc -c -I $(CBU_COPY_PATH) -I $(SAMPLE_COPY_PATH) TS000003.cob 28 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -L $(SAMPLE_LIB_PATH) -l Sample3 -o libTS3.dylib TS000003.o 29 | mv libTS3.dylib $(SAMPLE_TESTS_LIB_PATH) 30 | 31 | SUITE003: 32 | cobc -x -o SUITE003 -I $(CBU_COPY_PATH) -L $(CBU_LIB_PATH) -l CobolUnit -L $(SAMPLE_TESTS_LIB_PATH) -l TS3 -L $(SAMPLE1_TESTS_LIB_PATH) -l TS1 -L $(SAMPLE2_TESTS_LIB_PATH) -l TS2 SUITE003.cob 33 | mv SUITE003 $(SAMPLE_TESTS_PATH) 34 | 35 | test: 36 | ln -s $(CBU_LIB_PATH)/libCobolUnit.dylib $(SAMPLE_TESTS_PATH) 37 | ln -s $(SAMPLE_LIB_PATH)/libSample3.dylib $(SAMPLE_TESTS_PATH) 38 | ln -s $(SAMPLE_TESTS_LIB_PATH)/libTS3.dylib $(SAMPLE_TESTS_PATH) 39 | ln -s $(SAMPLE1_LIB_PATH)/libSample1.dylib $(SAMPLE_TESTS_PATH) 40 | ln -s $(SAMPLE1_TESTS_LIB_PATH)/libTS1.dylib $(SAMPLE_TESTS_PATH) 41 | ln -s $(SAMPLE2_LIB_PATH)/libSample2.dylib $(SAMPLE_TESTS_PATH) 42 | ln -s $(SAMPLE2_TESTS_LIB_PATH)/libTS2.dylib $(SAMPLE_TESTS_PATH) 43 | (cd $(SAMPLE_TESTS_PATH) && ./SUITE003) 44 | 45 | dirs: 46 | mkdir $(SAMPLE_LIB_PATH) 47 | mkdir $(SAMPLE_TESTS_PATH) 48 | mkdir $(SAMPLE_TESTS_LIB_PATH) 49 | 50 | clean: 51 | rm -f *.c *.h *.o *.s 52 | rm -rf *.so *.dylib 53 | rm -rf $(SAMPLE_TESTS_LIB_PATH) 54 | rm -rf $(SAMPLE_TESTS_PATH) 55 | rm -rf $(SAMPLE_LIB_PATH) 56 | 57 | 58 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample3/SAMPLE03.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SAMPLE03. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000071 01 E PIC 99. 9 | 000072 01 F PIC 99. 10 | 000073 COPY SAMPC001. 11 | 000074 COPY SAMPC002. 12 | 000075 13 | 000076 LINKAGE SECTION. 14 | 000077 01 A PIC 99. 15 | 000078 01 B PIC 99. 16 | 000079 01 C PIC 99. 17 | 000080 01 D PIC 99. 18 | 000081 01 RES PIC 99. 19 | 000082 PROCEDURE DIVISION USING A B C D RES. 20 | 000083 CALL SAMPLE01 USING A B E. 21 | 000084 DISPLAY E. 22 | 000085 CALL SAMPLE02 USING A C B F. 23 | 000093 DISPLAY F. 24 | 000094 COMPUTE RES = E + A + D. 25 | 000095 DISPLAY RES. 26 | 000104 END PROGRAM SAMPLE03. 27 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample3/SUITE003.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. SUITE003. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000090 COPY CBUC0002. 9 | 000091 01 str1 PIC X(20). 10 | 000092 01 str2 PIC X(100). 11 | 000093 01 RES PIC 99. 12 | 000095 COPY CBUC0001. 13 | 000096 PROCEDURE DIVISION. 14 | 000097 INITIALIZE str1 str2. 15 | 000098 MOVE "SUITE1" TO str1. 16 | 000099 MOVE "DESC SUITE1" TO str2. 17 | 000100 CALL CBU-initialize USING CBU-ctx. 18 | 000102 CALL CBU-add-suite USING CBU-ctx str1 str2. 19 | 000103 20 | 000104 INITIALIZE str1 str2. 21 | 000105 MOVE "TS000001" TO str1. 22 | 000106 MOVE "TEST1 desc" TO str2. 23 | 000108 CALL CBU-add-test-next USING CBU-ctx str1 str2. 24 | 000109 25 | 000110 INITIALIZE str1 str2. 26 | 000111 MOVE "TS000002" TO str1. 27 | 000112 MOVE "TEST2 desc" TO str2. 28 | 000114 CALL CBU-add-test-next USING CBU-ctx str1 str2. 29 | 000115 30 | 000116 INITIALIZE str1 str2. 31 | 000117 MOVE "TS000003" TO str1. 32 | 000118 MOVE "TEST3 desc" TO str2. 33 | 000119 CALL CBU-add-test-next USING CBU-ctx str1 str2. 34 | 000120 35 | 000121 CALL CBU-run USING CBU-ctx. 36 | 000130 END PROGRAM SUITE003. 37 | -------------------------------------------------------------------------------- /COBOLUnitSamples/Sample3/TS000003.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. TS000003. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000072 COPY CBUC0002. 9 | 000073 COPY SAMPC003. 10 | 000080 01 A PIC 99. 11 | 000081 01 B PIC 99. 12 | 000082 01 C PIC 99. 13 | 000083 01 D PIC 99. 14 | 000084 01 RES PIC 99. 15 | 000085 01 EXPECTED PIC 99. 16 | 000086 01 assert-name PIC X(20). 17 | 000087 LINKAGE SECTION. 18 | 000088 COPY CBUC0001. 19 | 000089 PROCEDURE DIVISION USING CBU-ctx. 20 | 000090 MOVE 7 TO EXPECTED. 21 | 000091 MOVE 2 TO A. 22 | 000092 MOVE 2 TO B. 23 | 000093 MOVE 2 TO C. 24 | 000094 MOVE 5 TO D. 25 | 000095 CALL "SAMPLE03" USING A B C D RES. 26 | 000096 MOVE "(2,2,2,5)=7" TO assert-name. 27 | 000097 CALL CBU-assert-nb3-equals 28 | 000098 USING CBU-ctx assert-name EXPECTED RES. 29 | 000100 END PROGRAM TS000003. 30 | -------------------------------------------------------------------------------- /COBOLUnitTests/COPY/CTUC0001.cob: -------------------------------------------------------------------------------- 1 | 000010 01 suite-name1 PIC X(20) EXTERNAL. 2 | 000011 01 suite-name2 PIC X(20) EXTERNAL. 3 | 000012 01 suite-name3 PIC X(20) EXTERNAL. 4 | 000013 01 suite-desc1 PIC X(100) EXTERNAL. 5 | 000014 01 suite-desc2 PIC X(100) EXTERNAL. 6 | 000015 01 suite-desc3 PIC X(100) EXTERNAL. 7 | 000016 8 | 000017 01 suite1-test1-name PIC X(20) EXTERNAL. 9 | 000018 01 suite1-test2-name PIC X(20) EXTERNAL. 10 | 000019 01 suite1-test3-name PIC X(20) EXTERNAL. 11 | 000020 12 | 000021 01 suite2-test1-name PIC X(20) EXTERNAL. 13 | 000022 01 suite2-test2-name PIC X(20) EXTERNAL. 14 | 000023 01 suite2-test3-name PIC X(20) EXTERNAL. 15 | 000024 16 | 000025 01 suite3-test1-name PIC X(20) EXTERNAL. 17 | 000026 01 suite3-test2-name PIC X(20) EXTERNAL. 18 | 000027 01 suite3-test3-name PIC X(20) EXTERNAL. 19 | 000028 01 suite3-test4-name PIC X(20) EXTERNAL. 20 | 000029 21 | 000030 01 suite1-test1-desc PIC X(100) EXTERNAL. 22 | 000031 01 suite1-test2-desc PIC X(100) EXTERNAL. 23 | 000032 01 suite1-test3-desc PIC X(100) EXTERNAL. 24 | 000033 25 | 000034 01 suite2-test1-desc PIC X(100) EXTERNAL. 26 | 000035 01 suite2-test2-desc PIC X(100) EXTERNAL. 27 | 000036 01 suite2-test3-desc PIC X(100) EXTERNAL. 28 | 000037 29 | 000038 01 suite3-test1-desc PIC X(100) EXTERNAL. 30 | 000039 01 suite3-test2-desc PIC X(100) EXTERNAL. 31 | 000040 01 suite3-test3-desc PIC X(100) EXTERNAL. 32 | 000041 01 suite3-test4-desc PIC X(100) EXTERNAL. 33 | 000042 34 | 000043 01 string-expected PIC X(32000) EXTERNAL. 35 | 000044 01 string-actual PIC X(32000) EXTERNAL. 36 | 000045 01 MaSuite. 37 | 000046 05 SuiteN PIC X(20) . 38 | 000047 05 SuiteD PIC X(100). 39 | 000048 05 SuiteS PIC 9(2). 40 | 000049 05 nb-test-r PIC 9(3). 41 | 000050 05 nb-suite-s PIC 9(3). 42 | 000051 05 nb-suite-f PIC 9(3). 43 | 000052 05 nb-suite-e PIC 9(3). 44 | 000053 01 MonTest. 45 | 000054 05 TestN PIC X(20) VALUE SPACES. 46 | 000055 05 TestD PIC X(100) VALUE SPACES. 47 | 000056 05 assert-r PIC 9(3). 48 | 000057 05 nb-assert-s PIC 9(3). 49 | 000058 05 nb-assert-f PIC 9(3). 50 | 000062 01 assert-name PIC X(20) EXTERNAL. 51 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU000S1.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU000S1. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000060 DATA DIVISION. 6 | 000070 WORKING-STORAGE SECTION. 7 | 000071 COPY CBUC0002. 8 | 000072 COPY CBUC0001. 9 | 000073 COPY CTUC0001. 10 | 000080 PROCEDURE DIVISION. 11 | 000090 INITIALIZE string-expected. 12 | 000091 INITIALIZE string-actual. 13 | 000092 MOVE "Suite1" TO suite-name1. 14 | 000093 MOVE "Suite2" TO suite-name2. 15 | 000094 MOVE "Suite3" TO suite-name3. 16 | 000095 MOVE "Suite1 description blablabla" TO 17 | 000096 suite-desc1. 18 | 000097 MOVE "Suite2 description descriop" TO 19 | 000098 suite-desc2. 20 | 000099 MOVE "Suite3 more Suite3" TO suite-desc3. 21 | 000100 CALL CBU-initialize USING CBU-ctx. 22 | 000101 MOVE "test-nb-suite-1" TO assert-name. 23 | 000102 24 | 000103 MOVE "CTU0S1T1" TO suite1-test1-name. 25 | 000104 MOVE "CTU0S1T2" TO suite1-test2-name. 26 | 000105 MOVE "CTU0S2T1" TO suite2-test1-name. 27 | 000106 MOVE "CTU0S3T1" TO suite3-test1-name. 28 | 000107 MOVE "CTU0S3T2" TO suite3-test2-name. 29 | 000108 MOVE "CTU0S3T3" TO suite3-test3-name. 30 | 000109 31 | 000110 MOVE "suite1-test1-desc" TO suite1-test1-desc. 32 | 000111 MOVE "suite1-test2-desc" TO suite1-test2-desc. 33 | 000112 MOVE "suite2-test1-desc" TO suite2-test1-desc. 34 | 000113 MOVE "suite3-test1-desc" TO suite3-test1-desc. 35 | 000114 MOVE "suite3-test2-desc" TO suite3-test2-desc. 36 | 000115 MOVE "suite3-test3-desc" TO suite3-test3-desc. 37 | 000116 38 | 000119* Add suite1 39 | 000120 CALL CBU-add-suite 40 | 000121 USING CBU-ctx suite-name1 suite-desc1. 41 | 000122** Add test to suite1 42 | 000123 CALL CBU-add-test-next USING 43 | 000124 CBU-ctx suite1-test1-name suite1-test1-desc. 44 | 000125 CALL CBU-add-test-next USING 45 | 000126 CBU-ctx suite1-test2-name suite1-test2-desc. 46 | 000127 47 | 000128* Add suite2 48 | 000129 CALL CBU-add-suite 49 | 000130 USING CBU-ctx suite-name2 suite-desc2. 50 | 000131** Add tests to suite2 51 | 000132 CALL CBU-add-test-next USING 52 | 000133 CBU-ctx suite2-test1-name suite2-test1-desc. 53 | 000137* Add Suite3 54 | 000140* CALL CBU-add-suite USING CBU-ctx suite-name3 suite-desc3. 55 | 000141** Add test to suite3 56 | 000143* CALL CBU-add-test-next USING 57 | 000144* CBU-ctx suite3-test1-name suite3-test1-desc. 58 | 000145* CALL CBU-add-test-next USING 59 | 000147* CBU-ctx suite3-test2-name suite3-test2-desc. 60 | 000149* CALL CBU-add-test-next USING 61 | 000151* CBU-ctx suite3-test3-name suite3-test3-desc. 62 | 000153 63 | 000154 64 | 000155 CALL CBU-run USING CBU-ctx. 65 | 000156* CALL CBU-display-res. 66 | 000157* CALL CBU-display-suite. 67 | 000158 68 | 000160 END PROGRAM CTU000S1. 69 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU0S1T1.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU0S1T1. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000071 01 str-expected PIC X(32000). 9 | 000072 01 str-actual PIC X(32000). 10 | 000073 01 assert-name PIC X(20). 11 | 000074 01 nb-expected PIC 999. 12 | 000075 01 nb-actual PIC 999. 13 | 000077 COPY CBUC0002. 14 | 000078 LINKAGE SECTION. 15 | 000079 COPY CBUC0001. 16 | 000080 PROCEDURE DIVISION USING CBU-ctx. 17 | 000082 INITIALIZE str-expected. 18 | 000083 INITIALIZE str-actual. 19 | 000084 INITIALIZE nb-expected. 20 | 000085 INITIALIZE nb-actual. 21 | 000086 MOVE "TOTO" TO str-expected. 22 | 000087 MOVE "TOTO" TO str-actual. 23 | 000090 24 | 000101 25 | 000102 MOVE "ass1-TRUE" TO assert-name. 26 | 000103 CALL CBU-assert-str-equals USING 27 | 000104 CBU-ctx 28 | 000105 assert-name 29 | 000106 str-expected 30 | 000107 str-actual. 31 | 000108 32 | 000109 MOVE "ass2--TRUE" TO assert-name. 33 | 000110 CALL CBU-assert-str-equals USING 34 | 000111 CBU-ctx 35 | 000112 assert-name 36 | 000113 str-expected 37 | 000114 str-actual. 38 | 000115 39 | 000116 MOVE "nb-assert-run" TO assert-name. 40 | 000117 MOVE 3 TO nb-expected. 41 | 000118 CALL CBU-assert-nb3-equals USING 42 | 000119 CBU-ctx 43 | 000120 assert-name 44 | 000121 nb-expected 45 | 000122 nb-assert-run(1,1). 46 | 000123 47 | 000124 MOVE "nb-assert-true1" TO assert-name. 48 | 000125 MOVE 3 TO nb-expected. 49 | 000126 CALL CBU-assert-nb3-equals USING 50 | 000127 CBU-ctx 51 | 000128 assert-name 52 | 000129 nb-expected 53 | 000130 nb-assert-succeed(1,1). 54 | 000131 55 | 000132 MOVE "nb-assert-true2" TO assert-name. 56 | 000133 MOVE 4 TO nb-expected. 57 | 000134 CALL CBU-assert-nb3-equals USING 58 | 000135 CBU-ctx 59 | 000136 assert-name 60 | 000137 nb-expected 61 | 000138 nb-assert-succeed(1,1). 62 | 000139 63 | 000140 MOVE "nb-assert-run2" TO assert-name. 64 | 000141 MOVE 6 TO nb-expected. 65 | 000142 CALL CBU-assert-nb3-equals USING 66 | 000143 CBU-ctx 67 | 000144 assert-name 68 | 000145 nb-expected 69 | 000146 nb-assert-run(1,1). 70 | 000147 71 | 000148 72 | 000150 END PROGRAM CTU0S1T1. 73 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU0S1T2.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU0S1T2. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000080 01 str-expected PIC X(32000). 9 | 000090 01 str-actual PIC X(32000). 10 | 000091 01 assert-name PIC X(20). 11 | 000092 01 nb-expected PIC 999. 12 | 000093 01 nb-actual PIC 999. 13 | 000094 COPY CBUC0002. 14 | 000095 LINKAGE SECTION. 15 | 000096 COPY CBUC0001. 16 | 000097 PROCEDURE DIVISION USING CBU-ctx. 17 | 000099 INITIALIZE str-expected. 18 | 000100 INITIALIZE str-actual. 19 | 000101 INITIALIZE nb-expected. 20 | 000102 INITIALIZE nb-actual. 21 | 000103 MOVE "TOTO" TO str-expected. 22 | 000104 MOVE "TOTO" TO str-actual. 23 | 000105 24 | 000106 MOVE "assert1" TO assert-name. 25 | 000107 CALL CBU-assert-str-equals USING 26 | 000108 CBU-ctx 27 | 000109 assert-name 28 | 000110 str-expected 29 | 000111 str-actual. 30 | 000112 31 | 000113 MOVE "assert2" TO assert-name. 32 | 000114 CALL CBU-assert-str-equals USING 33 | 000115 CBU-ctx 34 | 000116 assert-name 35 | 000117 str-expected 36 | 000118 str-actual. 37 | 000119 38 | 000120 MOVE "nb-assert3" TO assert-name. 39 | 000121 MOVE 3 TO nb-expected. 40 | 000122 CALL CBU-assert-nb3-equals USING 41 | 000123 CBU-ctx 42 | 000124 assert-name 43 | 000125 nb-expected 44 | 000126 nb-assert-run(1,2). 45 | 000127 46 | 000128 MOVE "assert-succes1" TO assert-name. 47 | 000129 MOVE 3 TO nb-expected. 48 | 000130 CALL CBU-assert-nb3-equals USING 49 | 000131 CBU-ctx 50 | 000132 assert-name 51 | 000133 nb-expected 52 | 000134 nb-assert-succeed(1,2). 53 | 000135 54 | 000136 MOVE "assert-succes2" TO assert-name. 55 | 000137 MOVE 4 TO nb-expected. 56 | 000138 CALL CBU-assert-nb3-equals USING 57 | 000139 CBU-ctx 58 | 000140 assert-name 59 | 000141 nb-expected 60 | 000142 nb-assert-succeed(1,2). 61 | 000143 62 | 000144 MOVE "nb-assert5" TO assert-name. 63 | 000145 MOVE 6 TO nb-expected. 64 | 000146 CALL CBU-assert-nb3-equals USING 65 | 000147 CBU-ctx 66 | 000148 assert-name 67 | 000149 nb-expected 68 | 000150 nb-assert-run(1,2). 69 | 000151 70 | 000160 END PROGRAM CTU0S1T2. 71 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU0S2T1.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU0S2T1. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000080 01 str-expected PIC X(32000). 9 | 000081 01 str-actual PIC X(32000). 10 | 000082 01 assert-name PIC X(20). 11 | 000083 01 nb-expected PIC 999. 12 | 000084 01 nb-actual PIC 999. 13 | 000085 01 p1 USAGE IS POINTER. 14 | 000086 01 p2 USAGE IS POINTER. 15 | 000088 COPY CBUC0002. 16 | 000089 01 MaSuite . 17 | 000090 10 SuiteN PIC X(20). 18 | 000091 10 SuiteD PIC X(50). 19 | 000092 10 suite-siz PIC 9(2). 20 | 000093 10 nb-test-siz PIC 9(3). 21 | 000094 10 nb-test-r PIC 9(3). 22 | 000095 10 nb-test-succ PIC 9(3). 23 | 000096 10 nb-test-fail PIC 9(3). 24 | 000097 10 nb-test-err PIC 9(3). 25 | 000099 26 | 000100 LINKAGE SECTION. 27 | 000101 COPY CBUC0001. 28 | 000102 29 | 000108 PROCEDURE DIVISION USING CBU-ctx. 30 | 000137 MOVE 3 TO nb-expected. 31 | 000138 MOVE "nb-suite" TO assert-name. 32 | 000139 MOVE SuiteIndex TO nb-actual. 33 | 000140 CALL CBU-assert-nb3-equals 34 | 000141 USING CBU-ctx assert-name nb-expected nb-actual. 35 | 000150 36 | 000160 MOVE 2 TO nb-expected. 37 | 000161 MOVE "nb-tests-S1" TO assert-name. 38 | 000163 MOVE nb-test-size(1) TO nb-actual. 39 | 000164 CALL CBU-assert-nb3-equals 40 | 000165 USING CBU-ctx assert-name nb-expected nb-actual. 41 | 000166 42 | 000167 MOVE 1 TO nb-expected. 43 | 000168 MOVE "nb-tests-S2" TO assert-name. 44 | 000169 MOVE nb-test-size(2) TO nb-actual. 45 | 000170 CALL CBU-assert-nb3-equals 46 | 000171 USING CBU-ctx assert-name nb-expected nb-actual. 47 | 000172 48 | 000173 INITIALIZE str-expected. 49 | 000174 INITIALIZE str-actual. 50 | 000175 MOVE "CTU0S2T1" TO str-expected. 51 | 000176 MOVE TestName(2,1) TO str-actual. 52 | 000178 MOVE "name-S2T1" TO assert-name. 53 | 000189 CALL CBU-assert-str-equals USING 54 | 000190 CBU-ctx 55 | 000191 assert-name 56 | 000192 str-expected 57 | 000193 str-actual. 58 | 000194 59 | 000195 INITIALIZE str-expected. 60 | 000196 INITIALIZE str-actual. 61 | 000197 MOVE "CTU0S1T1" TO str-expected. 62 | 000198 MOVE TestName(1,1) TO str-actual. 63 | 000199 MOVE "name-S1T1" TO assert-name. 64 | 000200 CALL CBU-assert-str-equals USING 65 | 000201 CBU-ctx 66 | 000202 assert-name 67 | 000203 str-expected 68 | 000204 str-actual. 69 | 000205 70 | 000206 INITIALIZE str-expected. 71 | 000207 INITIALIZE str-actual. 72 | 000208 MOVE "Suite1" TO str-expected. 73 | 000209 MOVE SuiteName(1) TO str-actual. 74 | 000210 MOVE "suite-name" TO assert-name. 75 | 000211 CALL CBU-assert-str-equals USING 76 | 000212 CBU-ctx 77 | 000213 assert-name 78 | 000214 str-expected 79 | 000215 str-actual. 80 | 000216 81 | 000217 INITIALIZE str-expected. 82 | 000218 INITIALIZE str-actual. 83 | 000219 MOVE "Suite2 description descriop" TO str-expected. 84 | 000220 MOVE SuiteDesc(2) TO str-actual. 85 | 000221 MOVE "suite-desc" TO assert-name. 86 | 000222 CALL CBU-assert-str-equals USING 87 | 000223 CBU-ctx 88 | 000224 assert-name 89 | 000225 str-expected 90 | 000226 str-actual. 91 | 000227 92 | 000228 93 | 000229 MOVE 3 TO nb-expected. 94 | 000230 MOVE "nb-tests-S3" TO assert-name. 95 | 000231 MOVE nb-test-size(3) TO nb-actual. 96 | 000232 CALL CBU-assert-str-equals USING 97 | 000233 CBU-ctx 98 | 000234 assert-name 99 | 000235 str-expected 100 | 000236 str-actual. 101 | 000237 102 | 000238 103 | 000240 END PROGRAM CTU0S2T1. 104 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU0S3T1.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU0S3T1. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000080 COPY CBUC0002. 9 | 000081 LINKAGE SECTION. 10 | 000082 COPY CBUC0001. 11 | 000083 PROCEDURE DIVISION USING CBU-ctx. 12 | 000084 13 | 000090 14 | 000100 END PROGRAM CTU0S3T1. 15 | -------------------------------------------------------------------------------- /COBOLUnitTests/CTU0S3T2.cob: -------------------------------------------------------------------------------- 1 | 000010*> 2 | 000020 IDENTIFICATION DIVISION. 3 | 000030 PROGRAM-ID. CTU0S3T2. 4 | 000040 ENVIRONMENT DIVISION. 5 | 000050 CONFIGURATION SECTION. 6 | 000060 DATA DIVISION. 7 | 000070 WORKING-STORAGE SECTION. 8 | 000080 COPY CBUC0002. 9 | 000081 LINKAGE SECTION. 10 | 000082 COPY CBUC0001. 11 | 000083 PROCEDURE DIVISION USING CBU-ctx. 12 | 000084 13 | 000090 14 | 000100 END PROGRAM CTU0S3T2. 15 | -------------------------------------------------------------------------------- /COBOLUnitTests/Makefile: -------------------------------------------------------------------------------- 1 | CBU_PATH?=$(shell pwd)/../COBOLUnitLib 2 | CBU_LIB_PATH=$(CBU_PATH)/lib 3 | CBU_COPY_PATH=$(CBU_PATH)/COPY 4 | 5 | CBU_TESTS_PATH=$(shell pwd) 6 | CBU_TESTS_LIB_PATH=$(CBU_TESTS_PATH)/lib 7 | CBU_TESTS_COPY_PATH=$(CBU_TESTS_PATH)/COPY 8 | CBU_TESTS_TESTS_PATH=$(CBU_TESTS_PATH)/tests 9 | 10 | all: clean dirs CobolUnitTests test 11 | 12 | CobolUnitTests: 13 | cobc -c -b CTU0S1T1.cob CTU0S1T2.cob CTU0S2T1.cob CTU0S3T1.cob CTU0S3T2.cob -I $(CBU_COPY_PATH) -I $(CBU_TESTS_COPY_PATH) 14 | clang -dynamiclib -flat_namespace -undefined suppress -fno-common -DPIC -o libCBU_Tests.dylib *.o 15 | mv *.dylib $(CBU_TESTS_LIB_PATH) 16 | cobc -x -o CBU-test-suite -I $(CBU_COPY_PATH) -I $(CBU_TESTS_COPY_PATH) -L $(CBU_LIB_PATH) -l CobolUnit -L $(CBU_TESTS_LIB_PATH) -l CBU_Tests CTU000S1.cob 17 | mv CBU-test-suite $(CBU_TESTS_TESTS_PATH) 18 | 19 | test: 20 | ln -s $(CBU_LIB_PATH)/libCobolUnit.dylib $(CBU_TESTS_TESTS_PATH) 21 | ln -s $(CBU_TESTS_LIB_PATH)/libCBU_Tests.dylib $(CBU_TESTS_TESTS_PATH) 22 | (cd $(CBU_TESTS_TESTS_PATH) && ./CBU-test-suite) 23 | 24 | dirs: 25 | mkdir $(CBU_TESTS_LIB_PATH) 26 | mkdir $(CBU_TESTS_TESTS_PATH) 27 | 28 | clean: 29 | rm -f *.c *.h *.o *.s 30 | rm -rf *.so *.dylib 31 | rm -rf $(CBU_TESTS_TESTS_PATH) 32 | rm -rf $(CBU_TESTS_LIB_PATH) 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CBU=COBOLUnitLib 2 | CBU_TESTS=COBOLUnitTests 3 | CBU_SAMPLES=COBOLUnitSamples 4 | 5 | all: 6 | $(MAKE) -C $(CBU) 7 | $(MAKE) -C $(CBU_TESTS) 8 | $(MAKE) -C $(CBU_SAMPLES) 9 | 10 | clean: 11 | $(MAKE) -C $(CBU) clean 12 | $(MAKE) -C $(CBU_TESTS) clean 13 | $(MAKE) -C $(CBU_SAMPLES) clean 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | COBOLUnit 2 | ========= 3 | 4 | COBOLUnit is a unit testing framework for OpenCOBOL (fork) 5 | 6 | It is a fork from https://code.google.com/p/cobolunit/ 7 | 8 | COBOLUnit Features 9 | ------------------ 10 | 11 | * Two assertions types could be used: 12 | * Equals for string 13 | * Equals for numeric format 14 | * Declaration of a test which include assertions. 15 | * Declaration a tests suite including declared tests 16 | * Declaration of a suites tests case including declared suites 17 | * Add an assertion to a test 18 | * Add a test to a specific suite 19 | * Add a suite to the tests suites case 20 | * Run the global suites tests case 21 | * Run a specific test suites 22 | * Display log results 23 | 24 | Upcoming Features 25 | ----------------- 26 | 27 | * Create a log file with the log result 28 | * Adding a user suite context for each suite to enable its use during tests 29 | * Add 'SetUp' and 'Teardown' routines for suites to setup and teardown suite context 30 | * Code generation for the tests suites Case from a flat file 31 | * Adding new assert types (notEquals, greaterThan, LesserThan,...) 32 | --------------------------------------------------------------------------------