Unit test for testing of src/libbu/bitv.c has been written with appropriate changes to CMakelists.txt and Makefile.am
Your patch needs some work. Here are some hints what's missing:
- missing indentation inside main()
- main() parameters (argn/argv) are missing, even if they won't be unused
- you should return an error code other than 0 if the test failed
thanks for your comment d_rossberg. i have made the changes yyou suggested and re-submitted a new patch.
Next you have to follow the
- "1) Indentation whitespace" and
- "4) Names"
section in HACKING (see e.g. your PASS variable).
Furthermore, you should look for consistent newlines. E.g. you have sometimes 1 and sometimes 2 newlines between the functions. Sometimes no newline and then 1 or 2 inside a function. Look at the other BRL-CAD sources. Use 1 newline inside the functions to structure and 2 newlines between functions.
Thanks again d_rossberg. I have changed the variable names, the indentation and have made the newlines more consistent(2 b/w functions and 1 inside).
- You should structure your code with empty lines. Many functions are monolithic blocks. Look at the other test_~ programs in libbu to get an idea what I mean.
- There is a similar empty-line issue in your Makefile.
- Every 8 blanks at the beginning of a line should be replaced by 1 tab.
- The test fails at bu_hex_to_bitv: "ERROR: bitv length is not a multiple of two. Illegal hex bitv: "
thanks for your comments once again!
no more monolithic blocks now. 8 spaces have been replaced by tabs.
i have changed the Makefile too.
just one query:
when the input is "303" an error output is the RIGHT output since we cannot give in an odd number of digits for a hex input to bu_hex_to_bitv.. It SHOULD return a null pointer which is part of the code.
error output printed is from bu_hex_to_bitv. so probably i should make changes in the bu_hex_to_bitv command suppressing the error message when it is called from a test.
or is there a better method to do the same?
bu_hex_to_bitv() should stay as it is. You could give a short message in your test, something like: "Intentionally evoking an error here, a message about it is normal".
thanks! uploaded the new patch with the modified makefile, and the error message and the newlines. (test_bitv3.patch)
Please consider "3) Braces" from HACKING as well.
with proper braces.
Log in to post a comment.