Fix dictionary and rename readback test

This commit is contained in:
Nicolas Abril 2024-05-30 23:37:26 +02:00
parent 6182ac74fa
commit 137591f7ae
46 changed files with 46 additions and 83 deletions

View File

@ -1024,7 +1024,7 @@ impl AsRef<str> for Name {
}
impl Book {
pub fn hvmc_entrypoint(&self) -> &str {
pub fn hvm_entrypoint(&self) -> &str {
match self.entrypoint.as_ref().map(|e| e.as_ref()) {
Some("main" | "Main") | None => ENTRY_POINT,
Some(nam) => nam,

View File

@ -27,7 +27,7 @@ pub fn book_to_hvm(book: &Book, diags: &mut Diagnostics) -> Result<(hvm::ast::Bo
for rule in def.rules.iter() {
let net = term_to_hvm(&rule.body, &mut labels);
let name = if def.name == *main { book.hvmc_entrypoint().to_string() } else { def.name.0.to_string() };
let name = if def.name == *main { book.hvm_entrypoint().to_string() } else { def.name.0.to_string() };
match net {
Ok(net) => {

View File

@ -65,7 +65,7 @@ pub fn compile_book(
}
if opts.prune {
let prune_entrypoints = vec![book.hvmc_entrypoint().to_string()];
let prune_entrypoints = vec![book.hvm_entrypoint().to_string()];
prune_hvm_book(&mut hvm_book, &prune_entrypoints);
}

View File

@ -205,7 +205,7 @@ fn run_lazy() {
}
#[test]
fn readback_lnet() {
fn readback_hvm() {
run_golden_test_dir(function_name!(), &|code, _| {
let mut p = hvm::ast::CoreParser::new(code);
let net = p.parse_net()?;

View File

@ -1,7 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/compile_file/net_size_too_large.bend
---
Errors:
In definition 'Radix':
Definition is too large for hvm (size=120, max size=64). Please break it into smaller pieces.

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: examples/all_tree.bend
---
Bool/True

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: examples/alloc_small_tree.bend
---
T

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: examples/example.bend
---
8

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: examples/neg_fusion.bend
---
λa λ* a

View File

@ -1,6 +1,6 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/tup_add.bend
input_file: tests/golden_tests/readback_hvm/addition.bend
---
Warnings:
During readback:

View File

@ -1,6 +1,6 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/bad_net.bend
input_file: tests/golden_tests/readback_hvm/bad_net.bend
---
Warnings:
During readback:

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/bad_net1.bend
---
λa λb a

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/bad_net3.bend
---
λa λb a

View File

@ -1,5 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/complicated_dup.bend
input_file: tests/golden_tests/readback_hvm/complicated_dup.bend
---
λa (λ$b (a ($b $c)) λ$c (a ($b $c)))

View File

@ -1,5 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/fst_snd.bend
input_file: tests/golden_tests/readback_hvm/fst_snd.bend
---
(λa a (λb b {{1 3} 2}))

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/id.bend
---
λa a

View File

@ -1,6 +1,6 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/invalid_op2_op2.bend
input_file: tests/golden_tests/readback_hvm/invalid_op2_op2.bend
---
Warnings:
During readback:

View File

@ -1,5 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/match.bend
input_file: tests/golden_tests/readback_hvm/match.bend
---
switch a = 1 { 0: λb b; _: a-1; }

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/nested_let.bend
---
3

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/nested_tup.bend
---
{{1 2} {4 {3 5}}}

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/number.bend
---
10

View File

@ -0,0 +1,5 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_hvm/simple_tup.bend
---
{0 42}

View File

@ -1,6 +1,6 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/addition.bend
input_file: tests/golden_tests/readback_hvm/tup_add.bend
---
Warnings:
During readback:

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/bad_net1.bend
---
λa λb a

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/bad_net3.bend
---
λa λb a

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/id.bend
---
λa a

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/nested_let.bend
---
3

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/nested_tup.bend
---
{{1 2} {4 {3 5}}}

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/number.bend
---
10

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/readback_lnet/simple_tup.bend
---
{0 42}

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/run_file/field_vectorization.bend
---
Bool/T

View File

@ -1,5 +0,0 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/run_file/imp_empty_list.bend
---
λ* λa a