Forum > Windows

FPC 3.0.0: advice re dunit, initc

(1/2) > >>

pascalpopper:
Re FPC 3.0.0, I am wondering:

Which dunit system is best to use for maximum compatibility with recent versions of Delphi? (I tried what I believe is the latest fptest via svn update and the output at cmd level had too many ? symbols for my taste.)  Is anyone using unit-test source code that they share easily between Delphi DX10 and FPC 3.0.0 ?  Console output or GUI ?  I need something that can show unicode output without distortion because I need to test string content carefully.

Why is the initc unit shipped for win32 rtl but not win64 ?  After install, I find i386-win32\rtl\initc.o and .ppu  but nothing in the win64 area for that unit.  I found this source file, https://github.com/graemeg/freepascal/blob/master/rtl/win32/initc.pp, which compiles using win64 as long as the "property" line 23 is commented out.  Not sure what is going on with a property of a unit.  Is there a new/better cross-platform way to get the last system error number as an integer ??

The good news is that I have some of my core units compiling with FPC 3.  Now I just need to find out whether any of the code actually works. 

Seriously, congratulations on a big milestone with version 3.

Leledumbo:

--- Quote from: pascalpopper on December 03, 2015, 01:04:02 am ---Is there a new/better cross-platform way to get the last system error number as an integer ??

--- End quote ---
http://www.freepascal.org/docs-html/rtl/sysutils/getlastoserror.html

marcov:
afiak initc on windows is only a service unit to keep libgdb working in the IDE. IOW contrary to initc on *nix, it is not really an unit meant for end users.

This is visible in the cygwin dependency (and outdated anyway, since libgdb stopped using cygwin and switched mingw years ago)

Graeme:

--- Quote from: pascalpopper on December 03, 2015, 01:04:02 am ---fptest via svn update and the output at cmd level had too many ? symbols for my taste.)  Is anyone using unit-test source code that they share easily between Delphi DX10 and FPC 3.0.0 ?  Console output or GUI ?  I need something that can show unicode output without distortion because I need to test string content carefully.

--- End quote ---
I don't fully understand what you mean. What ? symbols?  For unit info and line number information (backtrace), or for failed test output?

If the latter, I don't see the need in using Unicode text in failed test messages either. eg: I write my unit tests as follows:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TTestTIUtils.tiIntlDateStorAsDateTime;var  dt: TDateTime;begin  dt := EncodeDate(2006, 1, 18) + EncodeTime(15, 19, 22, 0);  CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('20060118T151922'), 'Failed on 1');   dt := EncodeDate(2006, 1, 18);  CheckEquals(dt, tiUtils.tiIntlDateStorAsDateTime('20060118T000000'), 'Failed on 2');   dt := 0;  CheckEquals(dt, tiUtils.tiIntlDateStorAsDateTime('00000000T000000'), 'Failed on 3');   dt := EncodeTime(9, 10, 41, 22);  CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('00000000T091041'), 'Failed on 4');   dt := EncodeDate(1652, 6, 15) + EncodeTime(12, 34, 56, 12);  CheckNearEnough(dt, tiUtils.tiIntlDateStorAsDateTime('16520615T123456'), 'Failed on 5');end; 

Note that I always use error messages in the format "Failed on xxx", meaning if I get a failed report that says "TTestTIUtils.tiIntlDateStorAsDateTime failed on 5", I immediately know where to look in the unit tests, and know exactly what test failed.  In this case, I never need to bother with unicode output.

Can you give an example of a test case where you have ? symbol (assuming Unicode) issues?

Saying all that, FPC 3.0 has just been release - I haven't had the time to test FPTest thoroughly with FPC 3.0 yet.  But I would imaging that the RTL's TextCompare(), SameText() etc should handle Unicode text comparisons correctly. If not, that is likely an issue with FPC, not FPTest. FPTest uses the generic String data type, I still need to investigate how that translates in FPC 3.0

As for unit testing frameworks and compatibility with Delphi. In that case, use DUnit2 for Delphi and FPTest for FPC. The FPTest code is a fork of DUnit2, and both frameworks are used successfully in tiOPF's test suite - which is Delphi and FPC compatible.

Leledumbo:

--- Quote from: Graeme on December 04, 2015, 11:22:11 am ---I don't fully understand what you mean. What ? symbols?  For unit info and line number information (backtrace), or for failed test output?

--- End quote ---
From the next paragraph, I assume it's unicode characters which are not properly displayed so they become ? in the console output. No idea about this though, I haven't tried testing unicode string with fptest myself.

Navigation

[0] Message Index

[#] Next page

Go to full version