summaryrefslogtreecommitdiffstats
path: root/vendor/overload/tests/unary.rs
blob: 76a3925fe19ceada88052a0dc78ec9664fa42cd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern crate overload;
use overload::overload;
use std::ops;

#[derive(PartialEq, Debug)]
struct A(i32);

#[derive(PartialEq, Debug)]
struct B(i32);

overload!(- (a: A) -> B { B(-a.0) });
#[test]
fn neg() {
    assert_eq!(-A(3), B(-3));
}

overload!(! (a: A) -> B { B(!a.0) });
#[test]
fn not() {
    assert_eq!(!A(3), B(!3));
}