Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pkg/hints/math_hints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,3 +1138,35 @@ func TestSplitIntAssertRangeHintOutOfRangeError(t *testing.T) {
t.Errorf("SPLIT_INT_ASSERT_RANGE hint should have failed")
}
}

func TestIsQuadResidueOk(t *testing.T) {
vm := NewVirtualMachine()
vm.Segments.AddSegment()
idsManager := SetupIdsForTest(
map[string][]*MaybeRelocatable{
"x": {NewMaybeRelocatableFelt(FeltFromDecString("151461"))},
"y": {nil},
},
vm,
)

hintProcessor := CairoVmHintProcessor{}
hintData := any(HintData{
Ids: idsManager,
Code: IS_QUAD_RESIDUE,
})

err := hintProcessor.ExecuteHint(vm, &hintData, nil, nil)
if err != nil {
t.Errorf("IS_QUAD_RESIDUE hint failed with error: %s", err)

}

root, err := idsManager.GetFelt("y", vm)
if err != nil {
t.Errorf("failed to get Y: %s", err)
}
if root != FeltFromDecString("724216096429330872433307564225094804656986062203645968681663112868516882638") {
t.Errorf("Expected is_quad_residue(151461) == 724216096429330872433307564225094804656986062203645968681663112868516882638 Got: %v", root)
}
}