summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-01-10 10:57:50 +0100
committerOndrej Fabry <ofabry@cisco.com>2019-01-10 11:05:35 +0100
commit08266e35878f198e2fa59fcfc9f0fc3a4b1dfbf5 (patch)
tree1269acfc3bf6fdd47414eb64da3ecad4865e37d6 /vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
parent3ef6f210edcf7dd753733d46ec3f2dd5dc795b61 (diff)
Add support for string types
- strings are now generated as two fields for length and string itself - aliases are now sorted by name to prevent generating different code - dependencies are now managed by dep - binapi files are regenerated using VPP 19.01-rc0~622-g7b01e9e8 - old stats binary api has been deprecated and removed from VPP Change-Id: Ieb8515c73021339a45f407386f8e3d87dcf4469e Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go')
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go148
1 files changed, 0 insertions, 148 deletions
diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
deleted file mode 100644
index 43fdb1f..0000000
--- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeNumerically", func() {
- Context("when passed a number", func() {
- It("should support ==", func() {
- Ω(uint32(5)).Should(BeNumerically("==", 5))
- Ω(float64(5.0)).Should(BeNumerically("==", 5))
- Ω(int8(5)).Should(BeNumerically("==", 5))
- })
-
- It("should not have false positives", func() {
- Ω(5.1).ShouldNot(BeNumerically("==", 5))
- Ω(5).ShouldNot(BeNumerically("==", 5.1))
- })
-
- It("should support >", func() {
- Ω(uint32(5)).Should(BeNumerically(">", 4))
- Ω(float64(5.0)).Should(BeNumerically(">", 4.9))
- Ω(int8(5)).Should(BeNumerically(">", 4))
-
- Ω(uint32(5)).ShouldNot(BeNumerically(">", 5))
- Ω(float64(5.0)).ShouldNot(BeNumerically(">", 5.0))
- Ω(int8(5)).ShouldNot(BeNumerically(">", 5))
- })
-
- It("should support <", func() {
- Ω(uint32(5)).Should(BeNumerically("<", 6))
- Ω(float64(5.0)).Should(BeNumerically("<", 5.1))
- Ω(int8(5)).Should(BeNumerically("<", 6))
-
- Ω(uint32(5)).ShouldNot(BeNumerically("<", 5))
- Ω(float64(5.0)).ShouldNot(BeNumerically("<", 5.0))
- Ω(int8(5)).ShouldNot(BeNumerically("<", 5))
- })
-
- It("should support >=", func() {
- Ω(uint32(5)).Should(BeNumerically(">=", 4))
- Ω(float64(5.0)).Should(BeNumerically(">=", 4.9))
- Ω(int8(5)).Should(BeNumerically(">=", 4))
-
- Ω(uint32(5)).Should(BeNumerically(">=", 5))
- Ω(float64(5.0)).Should(BeNumerically(">=", 5.0))
- Ω(int8(5)).Should(BeNumerically(">=", 5))
-
- Ω(uint32(5)).ShouldNot(BeNumerically(">=", 6))
- Ω(float64(5.0)).ShouldNot(BeNumerically(">=", 5.1))
- Ω(int8(5)).ShouldNot(BeNumerically(">=", 6))
- })
-
- It("should support <=", func() {
- Ω(uint32(5)).Should(BeNumerically("<=", 6))
- Ω(float64(5.0)).Should(BeNumerically("<=", 5.1))
- Ω(int8(5)).Should(BeNumerically("<=", 6))
-
- Ω(uint32(5)).Should(BeNumerically("<=", 5))
- Ω(float64(5.0)).Should(BeNumerically("<=", 5.0))
- Ω(int8(5)).Should(BeNumerically("<=", 5))
-
- Ω(uint32(5)).ShouldNot(BeNumerically("<=", 4))
- Ω(float64(5.0)).ShouldNot(BeNumerically("<=", 4.9))
- Ω(int8(5)).Should(BeNumerically("<=", 5))
- })
-
- Context("when passed ~", func() {
- Context("when passed a float", func() {
- Context("and there is no precision parameter", func() {
- It("should default to 1e-8", func() {
- Ω(5.00000001).Should(BeNumerically("~", 5.00000002))
- Ω(5.00000001).ShouldNot(BeNumerically("~", 5.0000001))
- })
- })
-
- Context("and there is a precision parameter", func() {
- It("should use the precision parameter", func() {
- Ω(5.1).Should(BeNumerically("~", 5.19, 0.1))
- Ω(5.1).Should(BeNumerically("~", 5.01, 0.1))
- Ω(5.1).ShouldNot(BeNumerically("~", 5.22, 0.1))
- Ω(5.1).ShouldNot(BeNumerically("~", 4.98, 0.1))
- })
- })
- })
-
- Context("when passed an int/uint", func() {
- Context("and there is no precision parameter", func() {
- It("should just do strict equality", func() {
- Ω(5).Should(BeNumerically("~", 5))
- Ω(5).ShouldNot(BeNumerically("~", 6))
- Ω(uint(5)).ShouldNot(BeNumerically("~", 6))
- })
- })
-
- Context("and there is a precision parameter", func() {
- It("should use precision paramter", func() {
- Ω(5).Should(BeNumerically("~", 6, 2))
- Ω(5).ShouldNot(BeNumerically("~", 8, 2))
- Ω(uint(5)).Should(BeNumerically("~", 6, 1))
- })
- })
- })
- })
- })
-
- Context("when passed a non-number", func() {
- It("should error", func() {
- success, err := (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{5}}).Match("foo")
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "=="}).Match(5)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "~", CompareTo: []interface{}{3.0, "foo"}}).Match(5.0)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match(5)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match("foo")
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{nil}}).Match(0)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{0}}).Match(nil)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed an unsupported comparator", func() {
- It("should error", func() {
- success, err := (&BeNumericallyMatcher{Comparator: "!=", CompareTo: []interface{}{5}}).Match(4)
- Ω(success).Should(BeFalse())
- Ω(err).Should(HaveOccurred())
- })
- })
-})