From 8b0918ff1f67f6198e38bf3531c60b71daef45d5 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sun, 7 Oct 2018 20:56:33 +0700 Subject: [PATCH] Add more doc test and correct see also for vector relational functions. --- nalgebra-glm/src/vector_relational.rs | 62 ++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/nalgebra-glm/src/vector_relational.rs b/nalgebra-glm/src/vector_relational.rs index a12dd9c1..24763e06 100644 --- a/nalgebra-glm/src/vector_relational.rs +++ b/nalgebra-glm/src/vector_relational.rs @@ -52,9 +52,17 @@ pub fn any(v: &TVec) -> bool /// Component-wise equality comparison. /// +/// # Examples: +/// +/// ``` +/// # use nalgebra_glm as glm; +/// assert_eq!(glm::vec2(true, false), +/// glm::equal(&glm::vec2(1.0, 3.0), +/// &glm::vec2(1.0, 2.0))); +/// ``` +/// /// # See also: /// -/// * [`equal`](fn.equal.html) /// * [`greater_than`](fn.greater_than.html) /// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) @@ -68,10 +76,18 @@ pub fn equal(x: &TVec, y: &TVec) -> TVec` comparison. /// +/// # Examples: +/// +/// ``` +/// # use nalgebra_glm as glm; +/// assert_eq!(glm::vec2(false, true), +/// glm::greater_than(&glm::vec2(1.0, 3.0), +/// &glm::vec2(1.0, 2.0))); +/// ``` +/// /// # See also: /// /// * [`equal`](fn.equal.html) -/// * [`greater_than`](fn.greater_than.html) /// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) /// * [`less_than_equal`](fn.less_than_equal.html) @@ -84,11 +100,19 @@ pub fn greater_than(x: &TVec, y: &TVec) -> /// Component-wise `>=` comparison. /// +/// # Examples: +/// +/// ``` +/// # use nalgebra_glm as glm; +/// assert_eq!(glm::vec3(true, true, false), +/// glm::greater_than_equal(&glm::vec3(1.0, 3.0, 4.0), +/// &glm::vec3(1.0, 2.0, 5.0))); +/// ``` +/// /// # See also: /// /// * [`equal`](fn.equal.html) /// * [`greater_than`](fn.greater_than.html) -/// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) /// * [`less_than_equal`](fn.less_than_equal.html) /// * [`not`](fn.not.html) @@ -100,12 +124,20 @@ pub fn greater_than_equal(x: &TVec, y: &TVec(x: &TVec, y: &TVec) -> TVe /// Component-wise `>=` comparison. /// +/// # Examples: +/// +/// ``` +/// # use nalgebra_glm as glm; +/// assert_eq!(glm::vec3(true, false, true), +/// glm::less_than_equal(&glm::vec3(1.0, 3.0, 4.0), +/// &glm::vec3(1.0, 2.0, 5.0))); +/// ``` +/// /// # See also: /// /// * [`equal`](fn.equal.html) /// * [`greater_than`](fn.greater_than.html) /// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) -/// * [`less_than_equal`](fn.less_than_equal.html) /// * [`not`](fn.not.html) /// * [`not_equal`](fn.not_equal.html) pub fn less_than_equal(x: &TVec, y: &TVec) -> TVec @@ -149,7 +189,6 @@ pub fn less_than_equal(x: &TVec, y: &TVec) /// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) /// * [`less_than_equal`](fn.less_than_equal.html) -/// * [`not`](fn.not.html) /// * [`not_equal`](fn.not_equal.html) pub fn not(v: &TVec) -> TVec where DefaultAllocator: Alloc { @@ -158,6 +197,15 @@ pub fn not(v: &TVec) -> TVec /// Component-wise not-equality `!=`. /// +/// # Examples: +/// +/// ``` +/// # use nalgebra_glm as glm; +/// assert_eq!(glm::vec2(false, true), +/// glm::not_equal(&glm::vec2(1.0, 3.0), +/// &glm::vec2(1.0, 2.0))); +/// ``` +/// /// # See also: /// /// * [`equal`](fn.equal.html) @@ -165,7 +213,7 @@ pub fn not(v: &TVec) -> TVec /// * [`greater_than_equal`](fn.greater_than_equal.html) /// * [`less_than`](fn.less_than.html) /// * [`less_than_equal`](fn.less_than_equal.html) -/// * [`not_equal`](fn.not_equal.html) +/// * [`not`](fn.not.html) pub fn not_equal(x: &TVec, y: &TVec) -> TVec where DefaultAllocator: Alloc { x.zip_map(y, |x, y| x != y)