dud: A dub replacement

Robert Schadek rschadek at symmetryinvestments.com
Thu Jan 23 17:05:10 UTC 2020


dud needs your help.

I'm starting work on the dependency resolution and for that I had
to implement proper handling for Semantic Versions, Version 
Ranges,
and Version Unions(VersionUnion is basically a VersionRange[]).
The dependency resolution algorithm I want to implement (based on
the algorithm used by Dart) needs a few checks and operations on
those types.

```D
SemVer parseSemVer(string input);

Nullable!VersionRange parseVersionRange(string input);

alias Types = AliasSeq!((SemVer,VersionRange,VersionUnion);
static foreach(T, Types) {
     auto inv = invert(T);
     static foreach(S, Types) {
         bool allowsAll(T, T);
         bool allowsAll(T, S);
         bool allowsAll(S, T);

         bool allowsAny(T, T);
         bool allowsAny(T, S);
         bool allowsAny(S, T);

         auto unionOf(T, T);
         auto unionOf(T, S);
         auto unionOf(S, T);

         auto intersectionOf(T, T);
         auto intersectionOf(T, S);
         auto intersectionOf(S, T);

         auto differenceOf(T, T);
         auto differenceOf(T, S);
         auto differenceOf(S, T);
     }
}
```

I think I did okay work and the tests cover all/most cases.
But that's properly being a bit overconfident.

Therefore, it would be awesome if you could try to break
these functions and create PRs that break the functions.

The code can be found in the git here 
https://github.com/symmetryinvestments/dud
the relevant folder is semver.
The tests are located in the files:

allowsAny: semver/source/dud/semver/checkstest.d
allowsAll: semver/source/dud/semver/checkstest1.d
allowsAll: semver/source/dud/semver/setoperationtest.d
intersectionOf: semver/source/dud/semver/setoperationtest1.d
invert, differenceOf: semver/source/dud/semver/setoperationtest2.d
semver/source/dud/semver/versionrangetest.d

Building dud, and semver should be as easy as cloning and typing 
dud, dub test.

```sh
git clone https://github.com/symmetryinvestments/dud.git
cd dud/semver
dub test
```
should get you going.

DESTROY!




More information about the Digitalmars-d-announce mailing list