REBOL for COBOL programmers
Date written: October 25, 2012
This page explains an idea for testing your own "mezzanine" modules.
A general plan for writing your own modules
When you are planning a program, or in the process of writing it, you often find some procedure that you know will be used over and over again, and put that procedure into some sort of module that you can call into your program, and other programs. This idea is explained in the previous section on making your own "mezzanine" function.
There is another level to which you can take that idea, as you probably have done in COBOL programming. When you write one of these modules, don't just call it into your program and then continue on with writing the rest of the program. Instead, test this module independently to make sure it works, before you use it in your program.
To test the module, write a little test program. All this test program does is call in the module, run its various functions, and display the results. There are some advantages to this. You will be able to use your module with confidence that it works. Also, if you make some change to the module, you will be able to test that change without having to run whatever program includes the module.
The code samples below are the global services module mentioned elsewhere plus a small program that does nothing but test this module. If this information were being presented in a "classroom" manner, this concept might be developed a bit more slowly, but we are in a hurry here so the link below shows the whole module tester for the global services module. If you look at it, you will realize that it is very simple. It just calls each of the functions, formats the results, and displays the results. As a side-effect, examining the test program will show you a way of structuring a REBOL program, namely, write functions first, and then call them at the end of the program.
Left-clicking a link below will give a result that will depend on your computer, your browser, and maybe in whether or not you have REBOL installed. You should get either a new window with the code displayed, or a dialog box for saving the file on your own computer, or "opening" the file which makes no sense in this situation. Right-clicking should give you a menu from which you can save it to your own computer.
Global services module
This is the "Global services module" mentioned in the preceding section about making your own "mezzanine" modules.
Global services module tester
This is a program that will load the glb.r module and test most of the functions in it, displaying the test results for visual examination.
html printing module
This is the module that solves the "printing" problem by making an html page and letting the web browser to the printing
html printing module tester
This is a program that will load the htmlrep.r module and test most of the functions in it. You will have to start the browser manually.
PCL printing module
This is the module that solves the printing problem by writing PCL code to an HP printer on a Windows network.
PCL printing module tester
This is a program that will load the pclprt.r module and test most of the functions in it. Before you run the test, you will have to modify the pclprt.r file for the printers and server in your own environment.