Skip to content

Commit

Permalink
Update some E2E tests for separation of Ord and Eq
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchmindtree committed Feb 28, 2022
1 parent 2910296 commit 806fb5c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions test/src/e2e_vm_tests/test_programs/asm_expr_basic/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ name = "asm_expr_basic"
entry = "main.sw"

[dependencies]
core = { git = "http://github.com/FuelLabs/sway-lib-core" }
std = { git = "http://github.com/FuelLabs/sway-lib-std" }
core = { git = "http://github.com/FuelLabs/sway-lib-core", tag = "v0.0.1" }
std = { git = "http://github.com/FuelLabs/sway-lib-std", tag = "v0.0.1" }
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ fn main() -> u64 {
Y: bool,
}

impl core::ops::Ord for X {
impl core::ops::Eq for X {
fn eq(self, other: Self) -> bool {
asm(r1: self, r2: other, r3) {
eq r3 r2 r1;
r3: bool
}
}
}

impl core::ops::Ord for X {
fn lt(self, other: Self) -> bool {
asm(r1: self, r2: other, r3) {
lt r3 r2 r1;
Expand Down
5 changes: 2 additions & 3 deletions test/src/e2e_vm_tests/test_programs/if_elseif_enum/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ entry = "main.sw"
license = "Apache-2.0"
name = "if_elseif_enum"


[dependencies]
core = { git = "http://github.com/FuelLabs/sway-lib-core", tag = "v0.0.1" }
std = { git = "http://github.com/FuelLabs/sway-lib-std", tag = "v0.0.1" }
core = { git = "http://github.com/FuelLabs/sway-lib-core", tag = "v0.1.0" }
std = { git = "http://github.com/FuelLabs/sway-lib-std", tag = "v0.1.0" }
15 changes: 9 additions & 6 deletions test/src/e2e_vm_tests/test_programs/if_elseif_enum/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ enum PrimaryColor {
Blue: (),
}

impl core::ops::Eq for PrimaryColor {
fn eq(self, other: Self) -> bool {
asm(r1: self, r2: other, r3) {
eq r3 r1 r2;
r3: bool
}
}
}

impl core::ops::Ord for PrimaryColor {
fn lt(self, other: Self) -> bool {
asm(r1: self, r2: other, r3) {
Expand All @@ -31,12 +40,6 @@ impl core::ops::Ord for PrimaryColor {
r3: bool
}
}
fn eq(self, other: Self) -> bool {
asm(r1: self, r2: other, r3) {
eq r3 r1 r2;
r3: bool
}
}
}

impl Color for PrimaryColor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
script;

use core::ops::Ord;
use core::ops::{Eq, Ord};

enum X {
Y: (),
}

impl Ord for X {
impl Eq for X {
fn eq(self, other: Self) -> bool {
true
}
}

impl Ord for X {
fn lt(self, other: Self) -> bool {
false
}
Expand Down

0 comments on commit 806fb5c

Please sign in to comment.