mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
change headers
This commit is contained in:
parent
3e3fe4fc7a
commit
ef362ada26
11 changed files with 4402 additions and 4487 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,157 +1,146 @@
|
||||||
#[macro_use]
|
#![cfg(test)]
|
||||||
extern crate pretty_assertions;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate indoc;
|
|
||||||
|
|
||||||
extern crate bumpalo;
|
use crate::assert_evals_to;
|
||||||
extern crate inkwell;
|
use crate::assert_llvm_evals_to;
|
||||||
extern crate libc;
|
use indoc::indoc;
|
||||||
extern crate roc_gen;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[test]
|
||||||
mod helpers;
|
fn basic_hash() {
|
||||||
|
assert_evals_to!(
|
||||||
#[cfg(test)]
|
indoc!(
|
||||||
mod gen_hash {
|
r#"
|
||||||
|
Dict.hashTestOnly 0 0
|
||||||
#[test]
|
"#
|
||||||
fn basic_hash() {
|
),
|
||||||
assert_evals_to!(
|
9718519427346233646,
|
||||||
indoc!(
|
u64
|
||||||
r#"
|
);
|
||||||
Dict.hashTestOnly 0 0
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
9718519427346233646,
|
fn hash_str_with_seed() {
|
||||||
u64
|
assert_evals_to!("Dict.hashTestOnly 1 \"a\"", 0xbed235177f41d328, u64);
|
||||||
);
|
assert_evals_to!("Dict.hashTestOnly 2 \"abc\"", 0xbe348debe59b27c3, u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn hash_str_with_seed() {
|
fn hash_record() {
|
||||||
assert_evals_to!("Dict.hashTestOnly 1 \"a\"", 0xbed235177f41d328, u64);
|
assert_evals_to!("Dict.hashTestOnly 1 { x: \"a\" } ", 0xbed235177f41d328, u64);
|
||||||
assert_evals_to!("Dict.hashTestOnly 2 \"abc\"", 0xbe348debe59b27c3, u64);
|
assert_evals_to!(
|
||||||
}
|
"Dict.hashTestOnly 1 { x: 42, y: 3.14 } ",
|
||||||
|
5348189196103430707,
|
||||||
#[test]
|
u64
|
||||||
fn hash_record() {
|
);
|
||||||
assert_evals_to!("Dict.hashTestOnly 1 { x: \"a\" } ", 0xbed235177f41d328, u64);
|
}
|
||||||
assert_evals_to!(
|
|
||||||
"Dict.hashTestOnly 1 { x: 42, y: 3.14 } ",
|
#[test]
|
||||||
5348189196103430707,
|
fn hash_result() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
"Dict.hashTestOnly 0 (List.get [ 0x1 ] 0) ",
|
||||||
}
|
2878521786781103245,
|
||||||
|
u64
|
||||||
#[test]
|
);
|
||||||
fn hash_result() {
|
}
|
||||||
assert_evals_to!(
|
|
||||||
"Dict.hashTestOnly 0 (List.get [ 0x1 ] 0) ",
|
#[test]
|
||||||
2878521786781103245,
|
fn hash_linked_list() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
LinkedList a : [ Nil, Cons a (LinkedList a) ]
|
||||||
#[test]
|
|
||||||
fn hash_linked_list() {
|
input : LinkedList I64
|
||||||
assert_evals_to!(
|
input = Nil
|
||||||
indoc!(
|
|
||||||
r#"
|
Dict.hashTestOnly 0 input
|
||||||
LinkedList a : [ Nil, Cons a (LinkedList a) ]
|
"#
|
||||||
|
),
|
||||||
input : LinkedList I64
|
0,
|
||||||
input = Nil
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 input
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
0,
|
r#"
|
||||||
u64
|
LinkedList a : [ Nil, Cons a (LinkedList a) ]
|
||||||
);
|
|
||||||
|
input : LinkedList I64
|
||||||
assert_evals_to!(
|
input = Cons 4 (Cons 3 Nil)
|
||||||
indoc!(
|
|
||||||
r#"
|
Dict.hashTestOnly 0 input
|
||||||
LinkedList a : [ Nil, Cons a (LinkedList a) ]
|
"#
|
||||||
|
),
|
||||||
input : LinkedList I64
|
8287696503006938486,
|
||||||
input = Cons 4 (Cons 3 Nil)
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 input
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
8287696503006938486,
|
fn hash_expr() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Expr : [ Add Expr Expr, Mul Expr Expr, Val I64, Var I64 ]
|
||||||
#[test]
|
|
||||||
fn hash_expr() {
|
x : Expr
|
||||||
assert_evals_to!(
|
x = Val 1
|
||||||
indoc!(
|
|
||||||
r#"
|
Dict.hashTestOnly 0 (Add x x)
|
||||||
Expr : [ Add Expr Expr, Mul Expr Expr, Val I64, Var I64 ]
|
"#
|
||||||
|
),
|
||||||
x : Expr
|
18264046914072177411,
|
||||||
x = Val 1
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 (Add x x)
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
18264046914072177411,
|
fn hash_nullable_expr() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Expr : [ Add Expr Expr, Mul Expr Expr, Val I64, Empty ]
|
||||||
#[test]
|
|
||||||
fn hash_nullable_expr() {
|
x : Expr
|
||||||
assert_evals_to!(
|
x = Val 1
|
||||||
indoc!(
|
|
||||||
r#"
|
Dict.hashTestOnly 0 (Add x x)
|
||||||
Expr : [ Add Expr Expr, Mul Expr Expr, Val I64, Empty ]
|
"#
|
||||||
|
),
|
||||||
x : Expr
|
11103255846683455235,
|
||||||
x = Val 1
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 (Add x x)
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
11103255846683455235,
|
fn hash_rosetree() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Rose a : [ Rose (List (Rose a)) ]
|
||||||
#[test]
|
|
||||||
fn hash_rosetree() {
|
x : Rose I64
|
||||||
assert_evals_to!(
|
x = Rose []
|
||||||
indoc!(
|
|
||||||
r#"
|
Dict.hashTestOnly 0 x
|
||||||
Rose a : [ Rose (List (Rose a)) ]
|
"#
|
||||||
|
),
|
||||||
x : Rose I64
|
0,
|
||||||
x = Rose []
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 x
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
0,
|
fn hash_list() {
|
||||||
u64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
x : List Str
|
||||||
#[test]
|
x = [ "foo", "bar", "baz" ]
|
||||||
fn hash_list() {
|
|
||||||
assert_evals_to!(
|
Dict.hashTestOnly 0 x
|
||||||
indoc!(
|
"#
|
||||||
r#"
|
),
|
||||||
x : List Str
|
10731521034618280801,
|
||||||
x = [ "foo", "bar", "baz" ]
|
u64
|
||||||
|
);
|
||||||
Dict.hashTestOnly 0 x
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
10731521034618280801,
|
|
||||||
u64
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,18 +1,8 @@
|
||||||
#[macro_use]
|
|
||||||
extern crate pretty_assertions;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate indoc;
|
|
||||||
|
|
||||||
extern crate bumpalo;
|
|
||||||
extern crate inkwell;
|
|
||||||
extern crate libc;
|
|
||||||
extern crate roc_gen;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
mod helpers;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod gen_num {
|
mod gen_num {
|
||||||
|
use crate::assert_evals_to;
|
||||||
|
use crate::assert_llvm_evals_to;
|
||||||
|
use indoc::indoc;
|
||||||
use roc_std::RocOrder;
|
use roc_std::RocOrder;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,111 +1,100 @@
|
||||||
#[macro_use]
|
#![cfg(test)]
|
||||||
extern crate pretty_assertions;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate indoc;
|
|
||||||
|
|
||||||
extern crate bumpalo;
|
use crate::assert_evals_to;
|
||||||
extern crate inkwell;
|
use crate::assert_llvm_evals_to;
|
||||||
extern crate libc;
|
use indoc::indoc;
|
||||||
extern crate roc_gen;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[test]
|
||||||
mod helpers;
|
fn with_default() {
|
||||||
|
assert_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
result : Result I64 {}
|
||||||
|
result = Ok 2
|
||||||
|
|
||||||
#[cfg(test)]
|
Result.withDefault result 0
|
||||||
mod gen_result {
|
"#
|
||||||
|
),
|
||||||
|
2,
|
||||||
|
i64
|
||||||
|
);
|
||||||
|
|
||||||
#[test]
|
assert_evals_to!(
|
||||||
fn with_default() {
|
indoc!(
|
||||||
assert_evals_to!(
|
r#"
|
||||||
indoc!(
|
result : Result I64 {}
|
||||||
r#"
|
result = Err {}
|
||||||
result : Result I64 {}
|
|
||||||
result = Ok 2
|
|
||||||
|
|
||||||
Result.withDefault result 0
|
Result.withDefault result 0
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
2,
|
0,
|
||||||
i64
|
i64
|
||||||
);
|
);
|
||||||
|
}
|
||||||
assert_evals_to!(
|
|
||||||
indoc!(
|
#[test]
|
||||||
r#"
|
fn result_map() {
|
||||||
result : Result I64 {}
|
assert_evals_to!(
|
||||||
result = Err {}
|
indoc!(
|
||||||
|
r#"
|
||||||
Result.withDefault result 0
|
result : Result I64 {}
|
||||||
"#
|
result = Ok 2
|
||||||
),
|
|
||||||
0,
|
result
|
||||||
i64
|
|> Result.map (\x -> x + 1)
|
||||||
);
|
|> Result.withDefault 0
|
||||||
}
|
"#
|
||||||
|
),
|
||||||
#[test]
|
3,
|
||||||
fn result_map() {
|
i64
|
||||||
assert_evals_to!(
|
);
|
||||||
indoc!(
|
|
||||||
r#"
|
assert_evals_to!(
|
||||||
result : Result I64 {}
|
indoc!(
|
||||||
result = Ok 2
|
r#"
|
||||||
|
result : Result I64 {}
|
||||||
result
|
result = Err {}
|
||||||
|> Result.map (\x -> x + 1)
|
|
||||||
|> Result.withDefault 0
|
result
|
||||||
"#
|
|> Result.map (\x -> x + 1)
|
||||||
),
|
|> Result.withDefault 0
|
||||||
3,
|
"#
|
||||||
i64
|
),
|
||||||
);
|
0,
|
||||||
|
i64
|
||||||
assert_evals_to!(
|
);
|
||||||
indoc!(
|
}
|
||||||
r#"
|
|
||||||
result : Result I64 {}
|
#[test]
|
||||||
result = Err {}
|
fn result_map_err() {
|
||||||
|
assert_evals_to!(
|
||||||
result
|
indoc!(
|
||||||
|> Result.map (\x -> x + 1)
|
r#"
|
||||||
|> Result.withDefault 0
|
result : Result {} I64
|
||||||
"#
|
result = Err 2
|
||||||
),
|
|
||||||
0,
|
when Result.mapErr result (\x -> x + 1) is
|
||||||
i64
|
Err n -> n
|
||||||
);
|
Ok _ -> 0
|
||||||
}
|
"#
|
||||||
|
),
|
||||||
#[test]
|
3,
|
||||||
fn result_map_err() {
|
i64
|
||||||
assert_evals_to!(
|
);
|
||||||
indoc!(
|
|
||||||
r#"
|
assert_evals_to!(
|
||||||
result : Result {} I64
|
indoc!(
|
||||||
result = Err 2
|
r#"
|
||||||
|
result : Result {} I64
|
||||||
when Result.mapErr result (\x -> x + 1) is
|
result = Ok {}
|
||||||
Err n -> n
|
|
||||||
Ok _ -> 0
|
when Result.mapErr result (\x -> x + 1) is
|
||||||
"#
|
Err n -> n
|
||||||
),
|
Ok _ -> 0
|
||||||
3,
|
"#
|
||||||
i64
|
),
|
||||||
);
|
0,
|
||||||
|
i64
|
||||||
assert_evals_to!(
|
);
|
||||||
indoc!(
|
|
||||||
r#"
|
|
||||||
result : Result {} I64
|
|
||||||
result = Ok {}
|
|
||||||
|
|
||||||
when Result.mapErr result (\x -> x + 1) is
|
|
||||||
Err n -> n
|
|
||||||
Ok _ -> 0
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
0,
|
|
||||||
i64
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,248 +1,237 @@
|
||||||
#[macro_use]
|
#![cfg(test)]
|
||||||
extern crate pretty_assertions;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate indoc;
|
|
||||||
|
|
||||||
extern crate bumpalo;
|
use crate::assert_evals_to;
|
||||||
extern crate inkwell;
|
use crate::assert_llvm_evals_to;
|
||||||
extern crate libc;
|
use indoc::indoc;
|
||||||
extern crate roc_gen;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[test]
|
||||||
mod helpers;
|
fn empty_len() {
|
||||||
|
assert_evals_to!(
|
||||||
#[cfg(test)]
|
indoc!(
|
||||||
mod gen_set {
|
r#"
|
||||||
|
Set.len Set.empty
|
||||||
#[test]
|
"#
|
||||||
fn empty_len() {
|
),
|
||||||
assert_evals_to!(
|
0,
|
||||||
indoc!(
|
usize
|
||||||
r#"
|
);
|
||||||
Set.len Set.empty
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
0,
|
fn singleton_len() {
|
||||||
usize
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.len (Set.singleton 42)
|
||||||
#[test]
|
"#
|
||||||
fn singleton_len() {
|
),
|
||||||
assert_evals_to!(
|
1,
|
||||||
indoc!(
|
usize
|
||||||
r#"
|
);
|
||||||
Set.len (Set.singleton 42)
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
1,
|
fn singleton_to_list() {
|
||||||
usize
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.toList (Set.singleton 42)
|
||||||
#[test]
|
"#
|
||||||
fn singleton_to_list() {
|
),
|
||||||
assert_evals_to!(
|
&[42],
|
||||||
indoc!(
|
&[i64]
|
||||||
r#"
|
);
|
||||||
Set.toList (Set.singleton 42)
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
&[42],
|
r#"
|
||||||
&[i64]
|
Set.toList (Set.singleton 1)
|
||||||
);
|
"#
|
||||||
|
),
|
||||||
assert_evals_to!(
|
&[1],
|
||||||
indoc!(
|
&[i64]
|
||||||
r#"
|
);
|
||||||
Set.toList (Set.singleton 1)
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
&[1],
|
r#"
|
||||||
&[i64]
|
Set.toList (Set.singleton 1.0)
|
||||||
);
|
"#
|
||||||
|
),
|
||||||
assert_evals_to!(
|
&[1.0],
|
||||||
indoc!(
|
&[f64]
|
||||||
r#"
|
);
|
||||||
Set.toList (Set.singleton 1.0)
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[1.0],
|
fn insert() {
|
||||||
&[f64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.empty
|
||||||
#[test]
|
|> Set.insert 0
|
||||||
fn insert() {
|
|> Set.insert 1
|
||||||
assert_evals_to!(
|
|> Set.insert 2
|
||||||
indoc!(
|
|> Set.toList
|
||||||
r#"
|
"#
|
||||||
Set.empty
|
),
|
||||||
|> Set.insert 0
|
&[0, 1, 2],
|
||||||
|> Set.insert 1
|
&[i64]
|
||||||
|> Set.insert 2
|
);
|
||||||
|> Set.toList
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[0, 1, 2],
|
fn remove() {
|
||||||
&[i64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.empty
|
||||||
#[test]
|
|> Set.insert 0
|
||||||
fn remove() {
|
|> Set.insert 1
|
||||||
assert_evals_to!(
|
|> Set.remove 1
|
||||||
indoc!(
|
|> Set.remove 2
|
||||||
r#"
|
|> Set.toList
|
||||||
Set.empty
|
"#
|
||||||
|> Set.insert 0
|
),
|
||||||
|> Set.insert 1
|
&[0],
|
||||||
|> Set.remove 1
|
&[i64]
|
||||||
|> Set.remove 2
|
);
|
||||||
|> Set.toList
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[0],
|
fn union() {
|
||||||
&[i64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
set1 : Set I64
|
||||||
#[test]
|
set1 = Set.fromList [1,2]
|
||||||
fn union() {
|
|
||||||
assert_evals_to!(
|
set2 : Set I64
|
||||||
indoc!(
|
set2 = Set.fromList [1,3,4]
|
||||||
r#"
|
|
||||||
set1 : Set I64
|
Set.union set1 set2
|
||||||
set1 = Set.fromList [1,2]
|
|> Set.toList
|
||||||
|
"#
|
||||||
set2 : Set I64
|
),
|
||||||
set2 = Set.fromList [1,3,4]
|
&[4, 2, 3, 1],
|
||||||
|
&[i64]
|
||||||
Set.union set1 set2
|
);
|
||||||
|> Set.toList
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[4, 2, 3, 1],
|
fn difference() {
|
||||||
&[i64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
set1 : Set I64
|
||||||
#[test]
|
set1 = Set.fromList [1,2]
|
||||||
fn difference() {
|
|
||||||
assert_evals_to!(
|
set2 : Set I64
|
||||||
indoc!(
|
set2 = Set.fromList [1,3,4]
|
||||||
r#"
|
|
||||||
set1 : Set I64
|
Set.difference set1 set2
|
||||||
set1 = Set.fromList [1,2]
|
|> Set.toList
|
||||||
|
"#
|
||||||
set2 : Set I64
|
),
|
||||||
set2 = Set.fromList [1,3,4]
|
&[2],
|
||||||
|
&[i64]
|
||||||
Set.difference set1 set2
|
);
|
||||||
|> Set.toList
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[2],
|
fn intersection() {
|
||||||
&[i64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
set1 : Set I64
|
||||||
#[test]
|
set1 = Set.fromList [1,2]
|
||||||
fn intersection() {
|
|
||||||
assert_evals_to!(
|
set2 : Set I64
|
||||||
indoc!(
|
set2 = Set.fromList [1,3,4]
|
||||||
r#"
|
|
||||||
set1 : Set I64
|
Set.intersection set1 set2
|
||||||
set1 = Set.fromList [1,2]
|
|> Set.toList
|
||||||
|
"#
|
||||||
set2 : Set I64
|
),
|
||||||
set2 = Set.fromList [1,3,4]
|
&[1],
|
||||||
|
&[i64]
|
||||||
Set.intersection set1 set2
|
);
|
||||||
|> Set.toList
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
&[1],
|
fn walk_sum() {
|
||||||
&[i64]
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.walk (Set.fromList [1,2,3]) (\x, y -> x + y) 0
|
||||||
#[test]
|
"#
|
||||||
fn walk_sum() {
|
),
|
||||||
assert_evals_to!(
|
6,
|
||||||
indoc!(
|
i64
|
||||||
r#"
|
);
|
||||||
Set.walk (Set.fromList [1,2,3]) (\x, y -> x + y) 0
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
6,
|
fn contains() {
|
||||||
i64
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
Set.contains (Set.fromList [1,3,4]) 4
|
||||||
#[test]
|
"#
|
||||||
fn contains() {
|
),
|
||||||
assert_evals_to!(
|
true,
|
||||||
indoc!(
|
bool
|
||||||
r#"
|
);
|
||||||
Set.contains (Set.fromList [1,3,4]) 4
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
true,
|
r#"
|
||||||
bool
|
Set.contains (Set.fromList [1,3,4]) 2
|
||||||
);
|
"#
|
||||||
|
),
|
||||||
assert_evals_to!(
|
false,
|
||||||
indoc!(
|
bool
|
||||||
r#"
|
);
|
||||||
Set.contains (Set.fromList [1,3,4]) 2
|
}
|
||||||
"#
|
|
||||||
),
|
#[test]
|
||||||
false,
|
fn from_list() {
|
||||||
bool
|
assert_evals_to!(
|
||||||
);
|
indoc!(
|
||||||
}
|
r#"
|
||||||
|
[1,2,2,3,1,4]
|
||||||
#[test]
|
|> Set.fromList
|
||||||
fn from_list() {
|
|> Set.toList
|
||||||
assert_evals_to!(
|
"#
|
||||||
indoc!(
|
),
|
||||||
r#"
|
&[4, 2, 3, 1],
|
||||||
[1,2,2,3,1,4]
|
&[i64]
|
||||||
|> Set.fromList
|
);
|
||||||
|> Set.toList
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
&[4, 2, 3, 1],
|
r#"
|
||||||
&[i64]
|
[]
|
||||||
);
|
|> Set.fromList
|
||||||
|
|> Set.toList
|
||||||
assert_evals_to!(
|
"#
|
||||||
indoc!(
|
),
|
||||||
r#"
|
&[],
|
||||||
[]
|
&[i64]
|
||||||
|> Set.fromList
|
);
|
||||||
|> Set.toList
|
|
||||||
"#
|
assert_evals_to!(
|
||||||
),
|
indoc!(
|
||||||
&[],
|
r#"
|
||||||
&[i64]
|
empty : List I64
|
||||||
);
|
empty = []
|
||||||
|
|
||||||
assert_evals_to!(
|
empty
|
||||||
indoc!(
|
|> Set.fromList
|
||||||
r#"
|
|> Set.toList
|
||||||
empty : List I64
|
"#
|
||||||
empty = []
|
),
|
||||||
|
&[],
|
||||||
empty
|
&[i64]
|
||||||
|> Set.fromList
|
);
|
||||||
|> Set.toList
|
|
||||||
"#
|
|
||||||
),
|
|
||||||
&[],
|
|
||||||
&[i64]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,9 @@ pub fn test_builtin_defs(symbol: Symbol, var_store: &mut VarStore) -> Option<Def
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is not actually dead code, but only used by cfg_test modules
|
||||||
|
// so "normally" it is dead, only at testing time is it used
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn helper<'a>(
|
pub fn helper<'a>(
|
||||||
arena: &'a bumpalo::Bump,
|
arena: &'a bumpalo::Bump,
|
||||||
src: &str,
|
src: &str,
|
||||||
|
|
|
@ -4,6 +4,14 @@
|
||||||
// we actually want to compare against the literal float bits
|
// we actually want to compare against the literal float bits
|
||||||
#![allow(clippy::clippy::float_cmp)]
|
#![allow(clippy::clippy::float_cmp)]
|
||||||
|
|
||||||
pub mod gen_tags;
|
pub mod gen_dict;
|
||||||
|
pub mod gen_hash;
|
||||||
|
pub mod gen_list;
|
||||||
|
pub mod gen_num;
|
||||||
pub mod gen_primitives;
|
pub mod gen_primitives;
|
||||||
|
pub mod gen_records;
|
||||||
|
pub mod gen_result;
|
||||||
|
pub mod gen_set;
|
||||||
|
pub mod gen_str;
|
||||||
|
pub mod gen_tags;
|
||||||
mod helpers;
|
mod helpers;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue