Jump to content

Stefan Glienke

Members
  • Content Count

    1428
  • Joined

  • Last visited

  • Days Won

    141

Everything posted by Stefan Glienke

  1. Stefan Glienke

    We use DUnitX and it discovers all our silly mistakes before release

    Among a few minor things it allows for a more declarative approach of writing tests by using attributes to provide the test data. In a classic DUnit test if you have to test an algorithm with 20 different value combinations you need to write 20 tests (either as different methods or by putting them into one test). However DUnit can be pimped to allow the same so you don't need to migrate (*) - since DUnit is kinda abandoned development wise Vincent decided to roll his own library instead of modifying and possibly cleaning up the code from DUnit which dates way back. (*) I did that way back even before DUnitX existed: https://stackoverflow.com/a/9006662/587106 and later also put that into a unit of Spring4D. As you can see in the screenshot you have multiple tests shown although there is only one method declared the extension takes care of producing them so you can run them individually (if for example certain data produces a failure) while you are fixing it. Another thing (which personally never bothered me much) is that with DUnitX you can write testcase classes without inheriting from a base class (this can also be done with an extension for DUnit - did it but never put it anywhere because it was not useful for me). The last thing that I remember is the fact that DUnitX can do is have fixture setup/teardown - they only run once even if there are multiple tests in the class - classic DUnit runs Setup/TearDown methods before and after every single test - guess what? You can also plug that onto DUnit. My personal opinion: do automated unit tests but it does not matter what framework you are using. I use DUnit with the before mentioned extensions and we do so at work because its powerful and compact. And regardless which one you are using - use them with TestInsight and make them part of your CI. 😉
  2. Stefan Glienke

    Blogged : Delphi Package Manager RFC

    Wasted effort imo - the fundamental design and architecture of the IDE and how (designtime)packages work is flawed to get something like this working properly. Unloading of packages often does not work properly because they are not written for that or some things that happen during loading cannot be easily undone (sloppy developer or simply because the API might be missing). Adding component/library to the IDE is not just loading a module but adding paths in numerous places, like library path for each supported platform, browsing path for stepping into code or even special debug DCU path. And last but not least because there is no strict rule how packages and files should be structured and if the library path should only point to DCUs or to pas files which often causes vendors to place their stuff all over the place and even require modifying the windows path variable (OMG how I hate that!)
  3. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    You should take a break - because it in fact is related to the ordinal value. The order is wtf, plough, foo, bar - but your array was wtf, plough, bar, foo
  4. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    Confusing sets with arrays because they look similar is the pitfall It does not, bar and foo are still reversed 😉
  5. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    That is why I wrote "strictly speaking" because there is always a difference between a formal language or syntax specification and its implementation based on its actual type. Currently probably every language that has some kind of for-in or foreach loop of course operates an array in order but that does not mean that you can assume this for every type operable with such loops. And when we are talking about "just for arrays" this is what is called "implementation detail".
  6. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    AFAIK you cannot inline declare an array in a for in loop so having some elements in between square brackets will always be a set. You can see it in your very own code on your blog article where you had to put them into an array variable first to then process them in the loop. The point I agree with though is that the fact that sets and arrays share its syntax might be confusing sometimes.
  7. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    I could answer that by quoting your previous comment 😉
  8. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    Strictly speaking assuming a specific order in a for-in loop is wrong to begin with.
  9. Stefan Glienke

    Delphi pitfalls: Enumerated types and for loops

    No I would not because its not a list but a set which are implemented as bitmask and thus have a fixed order.
  10. I just noticed yet another time that selecting text from a post contains invisible characters - in this particular case I selected the URL from this post: by selecting from the starting h of http and moved the mouse a bit to the right and down so it selected the entire rest of the line. When I then clicked "go to" in my context menu (using Chrome) I got a 404 which confused me because the url is valid. I eventually found out that the selected text contained some UTF-8 BOM bytes at the end. Also when inspecting the elements it showed this: which according to a google search is a zero width no-break space - turning off JS makes them disappear. The weird spans are also shown with Firefox however selecting the text does not cause it to contain garbage. Edit: I found what is causing the spans with the ZWNBSP - its the "quote selection" popup that leaves them there. So the issue I am describing here only happens when you selected the text, deselected and then selected again to contain the hidden ZWNBSP character.
  11. Stefan Glienke

    Which version of Delphi was StrToUInt64 introduced in

    There is no such function in the RTL, its called UIntToStr and has two overloads for Cardinal and UInt64 - it's there at least since Delphi XE and works there as far as I can tell. I don't immediately remember a bug with that function (which does not mean anything) - but I know there was a bug with the opposite related to System.Val which was fixed in XE4 - see https://stackoverflow.com/q/6077258/587106
  12. It probably is lacking the `()` there which it sometimes needs when invoking a method that returns an invokable type.
  13. Stefan Glienke

    Running UnitTests for Mobile Devices

    It basically does what "Run" does.
  14. Stefan Glienke

    Running UnitTests for Mobile Devices

    There is the IDE plugin that listens on the TCP port(range) specified in its settings and the client that is compiled into the test projects sends its result to it. What exactly should not work about that on any platform that can do TCP/IP?
  15. Stefan Glienke

    Running UnitTests for Mobile Devices

    What are you talking about?
  16. Stefan Glienke

    Running UnitTests for Mobile Devices

    Run it under the debugger so see where it's stuck?
  17. Stefan Glienke

    Running UnitTests for Mobile Devices

    https://bitbucket.org/sglienke/testinsight/wiki/Home On mobile you need a bare UI application though iirc - just make a form with a button that calls RunRegisteredTests. Either hardcode the uri to your developer machine or deploy the TestInsightSettings.ini that gets written next to the binary.
  18. Stefan Glienke

    Running UnitTests for Mobile Devices

    That's exactly what TestInsight does...
  19. Stefan Glienke

    Casbin4D

    Seems to be written in 10.3 where TStringDynArray is declared as TArray<string> whereas before it was a dedicated array of string. My suggestion is to not use the dynamic array types from System.Types anywhere and wherever you work with any RTL functions that use them, hardcast in order to be compatible to <10.3.
  20. Stefan Glienke

    Version Control System

    GitKraken is not free for commercial use though. I like using SourceTree (after the 2.x disaster in 3.x it's usable again).
  21. speed, min/max memory footprint, fragmentation, single/multi thread, sharing memory across threads?
  22. There clearly is a race condition somewhere in the SeaMM.dll - either it works, or it raises AVs until it stackoverflows or it gets stuck inside a loop (keep clicking Start/Stop if it does not raise AV/SO) with these instructions: 00007FF9B59FB520 664103D0 add dx,r8w 00007FF9B59FB524 488BD9 mov rbx,rcx 00007FF9B59FB527 66895774 mov [rdi+$74],dx 00007FF9B59FB52B 488B01 mov rax,[rcx] 00007FF9B59FB52E 488BC8 mov rcx,rax 00007FF9B59FB531 4883C801 or rax,$01 00007FF9B59FB535 4883F801 cmp rax,$01 00007FF9B59FB539 75E5 jnz $00007ff9b59fb520 Anyway as you seem to be the author/modifier of that code you should be able to debug that yourself. As soon as I put a breakpoint I could not get the AV - which confirms my guess about the race condition.
  23. Try removing the inline from function TIocpCrossSocket._NewIoData: PPerIoData; - possible that it trips over something there - apart from that I don't see how this could be related to anonymous methods. The variable assigned to is a local variable of a regular method and there are no anonymous methods in procedure TIocpCrossSocket._NewAccept(AListen: ICrossListen); that could change the location of that variable to somewhere else than the stack. Possible that the TBB code is sensitive to some garbage value in a volatile register that it does not properly check for.
  24. From looking at the callstack I am pretty sure there is a defect it's in your code namely in TIocpCrossSocket._NewAccept or the code that calls this method in case of AListen being nil.
  25. Stefan Glienke

    Caching with class variables

    Been there, done that. And one day the enum gets its 33. element and stuff subtly starts failing 😉
×