Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Oct 4, 2023
1 parent fa33713 commit 8bcee03
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/hints/blake2s_hints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,27 @@ func TestBlake2sFinaizeV3Ok(t *testing.T) {
t.Errorf("Wrong/No data loaded.\n Expected: %v.\n Got: %v", expectedDataSegment, dataSegment)
}
}

func TestExampleBlake2sCompressEmptyInput(t *testing.T) {
vm := NewVirtualMachine()
vm.Segments.AddSegment()
output := vm.Segments.AddSegment()
blake2sStart := vm.Segments.AddSegment()
idsManager := SetupIdsForTest(
map[string][]*MaybeRelocatable{
"output": {NewMaybeRelocatableRelocatable(output)},
"blake2s_start": {NewMaybeRelocatableRelocatable(blake2sStart)},
"n_bytes": {NewMaybeRelocatableFelt(FeltOne())},
},
vm,
)
hintProcessor := CairoVmHintProcessor{}
hintData := any(HintData{
Ids: idsManager,
Code: EXAMPLE_BLAKE2S_COMPRESS,
})
err := hintProcessor.ExecuteHint(vm, &hintData, nil, nil)
if err == nil {
t.Errorf("EXAMPLE_BLAKE2S_COMPRESS hint test should have failed")
}
}

0 comments on commit 8bcee03

Please sign in to comment.