diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c3779a..8485130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v0.3.3 + +* .throw must be @trusted, to allow to catch Errors +* Added .biggerOrEqualThan and .smallerOrEqualThan + # v0.3.2 * .equals and others, must be @trusted to allow to call @system opEquals diff --git a/README.md b/README.md index 464bfc6..ef0debe 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,14 @@ Asserts if a value is bigger than another value. Returns the result. 10.should.be.biggerThan(1); ``` +#### `bool biggerOrEqualThan(U)(U other, string file = __FILE__, size_t line = __LINE__);` + +Asserts if a value is bigger or euqal than another value. Returns the result. +```d +10.should.be.biggerOrEqualThan(1); +10.should.be.biggerOrEqualThan(10); +``` + #### `bool smallerThan(U)(U other, string file = __FILE__, size_t line = __LINE__)` Asserts if a value is smaller than another value. Returns the result. @@ -95,6 +103,14 @@ Asserts if a value is smaller than another value. Returns the result. false.should.be.smallerThan(true); ``` +#### `bool smallerOrEqualThan(U)(U other, string file = __FILE__, size_t line = __LINE__)` + +Asserts if a value is smaller or equal than another value. Returns the result. +```d +10.should.be.smallerOrEqualThan(100); +10.should.be.smallerOrEqualThan(10); +``` + #### `U include(U)(U other, string file = __FILE__, size_t line = __LINE__);` Asserts for an input range wrapped around an `Assertion` to contain/include a diff --git a/docs/changelog.md b/docs/changelog.md index 0f3d90e..c9590c5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,16 @@ layout: default title: Changelog --- +# v0.3.3 + +* .throw must be @trusted, to allow to catch Errors +* Added .biggerOrEqualThan and .smallerOrEqualThan + +# v0.3.2 + +* .equals and others, must be @trusted to allow to call @system opEquals +* .approxEquals to do approximated equality of float types + # v0.3.1 * Make Pijamas @safe diff --git a/docs/index.md b/docs/index.md index e6dae03..ed85b14 100644 --- a/docs/index.md +++ b/docs/index.md @@ -62,6 +62,15 @@ assertion. 255.should.equal(10); // Throws an Exception "expected 255 to equal 10" ``` +#### `T approxEqual(U)(U other, U maxRelDiff = 1e-2, U maxAbsDiff = 1e-05, string file = __FILE__, size_t line = __LINE__);` + +Asserts for aproximated equality of float types. Returns the value wrapped around the +assertion. +```d +(1.0f).should.be.approxEqual(1.00000001); +(1.0f).should.not.be.approxEqual(1.001); +``` + #### `T exist(string file = __FILE__, size_t line = __LINE__);` Asserts whether a value exists - currently simply compares it with `null`, if it @@ -82,6 +91,14 @@ Asserts if a value is bigger than another value. Returns the result. 10.should.be.biggerThan(1); ``` +#### `bool biggerOrEqualThan(U)(U other, string file = __FILE__, size_t line = __LINE__);` + +Asserts if a value is bigger or euqal than another value. Returns the result. +```d +10.should.be.biggerOrEqualThan(1); +10.should.be.biggerOrEqualThan(10); +``` + #### `bool smallerThan(U)(U other, string file = __FILE__, size_t line = __LINE__)` Asserts if a value is smaller than another value. Returns the result. @@ -90,6 +107,14 @@ Asserts if a value is smaller than another value. Returns the result. false.should.be.smallerThan(true); ``` +#### `bool smallerOrEqualThan(U)(U other, string file = __FILE__, size_t line = __LINE__)` + +Asserts if a value is smaller or equal than another value. Returns the result. +```d +10.should.be.smallerOrEqualThan(100); +10.should.be.smallerOrEqualThan(10); +``` + #### `U include(U)(U other, string file = __FILE__, size_t line = __LINE__);` Asserts for an input range wrapped around an `Assertion` to contain/include a diff --git a/docs/pijamas.html b/docs/pijamas.html index 4226ee2..99020e2 100644 --- a/docs/pijamas.html +++ b/docs/pijamas.html @@ -900,6 +900,57 @@
+
+ @trusted bool
+ biggerOrEqualThan
(U)(U other
, string file
= __FILE__, size_t line
= __LINE__);
+
+
+ Asserts if a value is bigger or equal than another value. Returns the result. + +
+
+
+
+
+ "z".should.be.biggerOrEqualThan("a");
+10.should.be.biggerOrEqualThan(10);
+20.should.be.biggerOrEqualThan(10);
+
+
+ @trusted bool
+ smallerOrEqualThan
(U)(U other
, string file
= __FILE__, size_t line
= __LINE__);
+
+
+ Asserts if a value is smaller or euqal than another value. Returns the result. + +
+
+
+
+
+ 10.should.be.smallerOrEqualThan(100);
+10.should.be.smallerOrEqualThan(10);
+false.should.be.smallerOrEqualThan(true);
+
- @safe void
Throw
(T : Throwable = Exception)(string file
= __FILE__, size_t line
= __LINE__);
+ @trusted void Throw
(T : Throwable = Exception)(string file
= __FILE__, size_t line
= __LINE__);