Just published my smallest ever open source project - 1 unit (not counting the
Just published my smallest ever open source project - 1 unit (not counting the
unit tests) https://github.com/VSoftTechnologies/SemanticVersion
A simple Semantic Version 2.0 parser - I needed one, couldn't find one for delphi so I baked my own.
https://github.com/VSoftTechnologies/SemanticVersion
unit tests) https://github.com/VSoftTechnologies/SemanticVersion
A simple Semantic Version 2.0 parser - I needed one, couldn't find one for delphi so I baked my own.
https://github.com/VSoftTechnologies/SemanticVersion
Some time ago I had to write something similar myself. One question: Why do you call the third digit of the version Release? It's called Patch or Bug version, isn't it?
ReplyDeleteGood question, I wrote this a while ago as part of a larger project, Ill change it.
ReplyDeleteseriously ?
ReplyDeleteclass function TSemanticVersion.IsDigit(const value: Char): boolean;
const
digits = ['0'..'9'];
begin
result := CharInSet(value,digits);
end;
once upon a time, Pascal lets you write value in ['0' .. '9']
Changed to Patch.
ReplyDeleteSo try result := value in digits;
ReplyDelete[dcc32 Warning] VSoft.SemanticVersion.pas(157): W1050 WideChar reduced to byte char in set expressions. Consider using 'CharInSet' function in 'SysUtils' unit.
This is one of thise things that was introduced with unicode support. I seem to recall in newer versions (than XE7, which I use every day) this has been reversed?
still opened :)
ReplyDeletequality.embarcadero.com - Log in - Embarcadero Technologies
I think you are missing some of the specifics for comparisons for pre-release - see paragraph 11 ("identifiers consisting of only digits are compared numerically and identifiers with letters or hyphens are compared lexically in ASCII sort order" and "Numeric identifiers always have lower precedence than non-numeric identifiers. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal.") - following test fails for example: 1.0.0-beta.2 < 1.0.0-beta.11
ReplyDeleteP.S. I am kinda disappointed that despite using DUnitX not using attributes for different version comparisons but write them all down manually in tests like IsGreaterThanEqualTo or IsGreaterThanPreRelease - see this for example: https://github.com/adamreeve/semver.net/blob/master/test/SemVer.Tests/VersionComparison.cs
I'll revisit the comparisons tomorrow. The tests were written with dunit years ago and i did a quicck n dirty conversation
ReplyDeleteThere is also:
ReplyDeleteuses System.Character;
...
result := value.IsDigit;
Uwe Raabe what version of delphi was this added in. Wanted to have broad compiper support without having an inc file and ifdefs everywhere
ReplyDeleteVincent Parrett As a record helper since XE4, as a class function since D2009.
ReplyDeleteUwe Raabe not sure I like the way it is coded against Value in ['0'..'9']...
ReplyDeletePaul TOTH Well, at least it works for any Unicode digit (not sure if this is actually needed here):
ReplyDeletefileformat.info - Unicode Characters in the 'Number, Decimal Digit' Category
Uwe Raabe I don't think that telugu or tamil number signs are valid here ;)
ReplyDeleteStefan Glienke Pushed some changes today, now comparing the labels correctly (I think), at least it's passing the tests you pointed me to. Also compiles and passes tests on XE2, I don't have any earlier versions installed to test on.
ReplyDeleteI think this is a step for https://plus.google.com/+JeroenPluimers/posts/K7UZ2Sognem
ReplyDeleteplus.google.com - Anyone tips for a TVersion structure that supports at max quad digits or wild...