mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
Equality tests passing for List I64
This commit is contained in:
parent
d58a2814f6
commit
e9ae8452b0
2 changed files with 4 additions and 3 deletions
|
@ -1002,6 +1002,7 @@ impl<'a> CodeGenHelp<'a> {
|
||||||
/// Another way to dereference a heap pointer is to use `Expr::UnionAtIndex`.
|
/// Another way to dereference a heap pointer is to use `Expr::UnionAtIndex`.
|
||||||
/// To achieve this we use `PtrCast` to cast the element pointer to a "Box" layout.
|
/// To achieve this we use `PtrCast` to cast the element pointer to a "Box" layout.
|
||||||
/// Then we can increment the Box pointer in a loop, dereferencing it each time.
|
/// Then we can increment the Box pointer in a loop, dereferencing it each time.
|
||||||
|
/// (An alternative approach would be to create a new lowlevel like ListPeekUnsafe.)
|
||||||
fn eq_list(&self, ident_ids: &mut IdentIds, elem_layout: &Layout<'a>) -> Stmt<'a> {
|
fn eq_list(&self, ident_ids: &mut IdentIds, elem_layout: &Layout<'a>) -> Stmt<'a> {
|
||||||
use LowLevel::*;
|
use LowLevel::*;
|
||||||
let layout_isize = self.layout_isize;
|
let layout_isize = self.layout_isize;
|
||||||
|
|
|
@ -467,14 +467,14 @@ fn list_eq_empty() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn list_eq_by_length() {
|
fn list_eq_by_length() {
|
||||||
assert_evals_to!("[1] == []", false, bool);
|
assert_evals_to!("[1] == []", false, bool);
|
||||||
assert_evals_to!("[] == [1]", false, bool);
|
assert_evals_to!("[] == [1]", false, bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn list_eq_compare_pointwise() {
|
fn list_eq_compare_pointwise() {
|
||||||
assert_evals_to!("[1] == [1]", true, bool);
|
assert_evals_to!("[1] == [1]", true, bool);
|
||||||
assert_evals_to!("[2] == [1]", false, bool);
|
assert_evals_to!("[2] == [1]", false, bool);
|
||||||
|
@ -488,7 +488,7 @@ fn list_eq_nested() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn list_neq_compare_pointwise() {
|
fn list_neq_compare_pointwise() {
|
||||||
assert_evals_to!("[1] != [1]", false, bool);
|
assert_evals_to!("[1] != [1]", false, bool);
|
||||||
assert_evals_to!("[2] != [1]", true, bool);
|
assert_evals_to!("[2] != [1]", true, bool);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue