fix tests

This commit is contained in:
Folkert 2021-02-17 22:56:37 +01:00
parent 65ab08728a
commit 3be7df1cac
3 changed files with 6 additions and 14 deletions

View file

@ -97,6 +97,10 @@ pub fn gen_from_mono_module(
if name.starts_with("roc_builtins.dict") || name.starts_with("dict.RocDict") {
function.add_attribute(AttributeLoc::Function, attr);
}
if name.starts_with("roc_builtins.list") || name.starts_with("list.RocList") {
function.add_attribute(AttributeLoc::Function, attr);
}
}
let builder = context.create_builder();

View file

@ -153,7 +153,7 @@ pub fn listKeepIf(list: RocList, transform: Opaque, caller: Caller1, alignment:
if (list.bytes) |source_ptr| {
const size = list.len();
var i: usize = 0;
var output = list.makeUnique(std.heap.c_allocator, alignment, list.len() * element_width);
var output = RocList.allocate(std.heap.c_allocator, alignment, list.len(), list.len() * element_width);
const target_ptr = output.bytes orelse unreachable;
var kept: usize = 0;

View file

@ -21,23 +21,11 @@ initialModel = \start ->
}
filterMap : List a, (a -> Result b *) -> List b
filterMap = \list, toResult ->
List.walk list (\element, accum ->
when toResult element is
Ok value ->
List.append accum value
Err _ ->
accum
)
[]
cheapestOpen : (position -> F64), Model position -> Result position {}
cheapestOpen = \costFn, model ->
model.openSet
|> Set.toList
|> filterMap (\position ->
|> List.keepOks (\position ->
when Dict.get model.costs position is
Err _ ->
Err {}