[types] Add some tests for equality of pairs
This commit is contained in:
parent
22f3c3a9e3
commit
9a728c9489
2 changed files with 24 additions and 1 deletions
|
@ -7,7 +7,7 @@ use std::fmt;
|
|||
use super::*;
|
||||
use object::Object;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Pair {
|
||||
pub car: Obj,
|
||||
pub cdr: Obj
|
||||
|
@ -72,4 +72,11 @@ impl PartialEq<Obj> for Pair {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Pair;
|
||||
|
||||
#[test]
|
||||
fn empty_pairs_are_equal() {
|
||||
let a = Pair::empty();
|
||||
let b = Pair::empty();
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
}
|
||||
|
|
16
types/tests/equality_value.rs
Normal file
16
types/tests/equality_value.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* types/tests/equality_value.rs
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
//! Tests of value-based equality for various types herein.
|
||||
|
||||
extern crate sibiltypes;
|
||||
|
||||
use sibiltypes::{Obj, Pair, Sym};
|
||||
|
||||
#[test]
|
||||
fn pairs_with_one_similar_symbol_are_equal() {
|
||||
let pa = Pair::with_car(Obj::new(Sym::with_str("ab")));
|
||||
let pb = Pair::with_car(Obj::new(Sym::with_str("ab")));
|
||||
assert_eq!(pa, pb);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue