Conversion of HTML pages to Delphi unit tests - 26/04/2018 05:47 EDT
$30-250 USD
Completed
Posted about 6 years ago
$30-250 USD
Paid on delivery
I like to have the Delphi code examples of the website DelphiBasics:
[login to view URL]
as a kind of DUnit test cases. The exact specification follows below.
The work should be done automatically with an according Perl or Python script. Delphi knowledge isn't necessary but advisable.
You can download a hand made example, which I made from
[login to view URL]
I explain the desired specification with this example.
1. at the upper right corner of
[login to view URL]
there is an index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z $
For each letter a list of examples for Delphi keywords is shown. For each referenced page a delphi test unit shall be created.
2. The name of the unit shall be the name of the example in lower case with the prefix "dbsc_". E.g. "Array" -> "dbsc_array".
3. Every unit test has to start with the following 5 lines, but with the according keyword instead of "array":
--------
unit dbsc_array;
//[login to view URL]
interface
function ArrayTest: boolean;
implementation
---------
4. On the array page you see the green block with the text:
Example code : Declaring and using static arrays
Such green blocks, beginning with the words "Example code", become the start of a test function. The functions have to be numbered. In the example:
-------
function ArrayTest1: boolean;
--------
5. The following block with code has to be copied into the unit test file.
--------
var
// Define static arrays
wordArray : Array[Word] of Integer; // Static, size=High(Word)
...
---------
6. The following green block quotes an expected output. This also has to be copied into the unit test file and it has to be put into curly brackets:
---------
{
wordArray length = 65536
wordArray lowest element = 0
...
}
----------
7. At the bottom of the produced unit test, a complete test function has to be written, where all function hitherto have to be called:
----------
function ArrayTest: boolean;
begin
result := true;
result := result and ArrayTest1;
result := result and ArrayTest2;
result := result and ArrayTest3;
end;
end.
----------
This is only the first step of the conversion to unit tests. Maybe that there will be a second job to complete it. But that job would require Delphi knowledge.