about summary refs log tree commit diff
path: root/src/test/ui/cmp-default.rs
diff options
context:
space:
mode:
authorChristiaan Dirkx <christiaan@dirkx.email>2020-11-22 09:08:04 +0100
committerChristiaan Dirkx <christiaan@dirkx.email>2020-11-30 02:47:32 +0100
commitbe554c4101df2a9ac65d40962ee37ece85d517bf (patch)
treede404d29144c6db9c24e81a2f6f8cb8d545abbe9 /src/test/ui/cmp-default.rs
parent349b3b324dade7ca638091db93ba08bbc443c63d (diff)
Make ui test that are run-pass and do not test the compiler itself library tests
Diffstat (limited to 'src/test/ui/cmp-default.rs')
-rw-r--r--src/test/ui/cmp-default.rs73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/test/ui/cmp-default.rs b/src/test/ui/cmp-default.rs
deleted file mode 100644
index bb5c39f5cde..00000000000
--- a/src/test/ui/cmp-default.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-// run-pass
-
-use std::cmp::Ordering;
-
-// Test default methods in PartialOrd and PartialEq
-//
-#[derive(Debug)]
-struct Fool(bool);
-
-impl PartialEq for Fool {
-    fn eq(&self, other: &Fool) -> bool {
-        let Fool(this) = *self;
-        let Fool(other) = *other;
-        this != other
-    }
-}
-
-struct Int(isize);
-
-impl PartialEq for Int {
-    fn eq(&self, other: &Int) -> bool {
-        let Int(this) = *self;
-        let Int(other) = *other;
-        this == other
-    }
-}
-
-impl PartialOrd for Int {
-    fn partial_cmp(&self, other: &Int) -> Option<Ordering> {
-        let Int(this) = *self;
-        let Int(other) = *other;
-        this.partial_cmp(&other)
-    }
-}
-
-struct RevInt(isize);
-
-impl PartialEq for RevInt {
-    fn eq(&self, other: &RevInt) -> bool {
-        let RevInt(this) = *self;
-        let RevInt(other) = *other;
-        this == other
-    }
-}
-
-impl PartialOrd for RevInt {
-    fn partial_cmp(&self, other: &RevInt) -> Option<Ordering> {
-        let RevInt(this) = *self;
-        let RevInt(other) = *other;
-        other.partial_cmp(&this)
-    }
-}
-
-pub fn main() {
-    assert!(Int(2) >  Int(1));
-    assert!(Int(2) >= Int(1));
-    assert!(Int(1) >= Int(1));
-    assert!(Int(1) <  Int(2));
-    assert!(Int(1) <= Int(2));
-    assert!(Int(1) <= Int(1));
-
-    assert!(RevInt(2) <  RevInt(1));
-    assert!(RevInt(2) <= RevInt(1));
-    assert!(RevInt(1) <= RevInt(1));
-    assert!(RevInt(1) >  RevInt(2));
-    assert!(RevInt(1) >= RevInt(2));
-    assert!(RevInt(1) >= RevInt(1));
-
-    assert_eq!(Fool(true), Fool(false));
-    assert!(Fool(true)  != Fool(true));
-    assert!(Fool(false) != Fool(false));
-    assert_eq!(Fool(false), Fool(true));
-}