NEWTON
Asked
6 months ago
11
views
0
I want to do some unit testing and need to pass in a felt* of value [1,2,3] into my function. How do I do this?
ㅤ This question was originally posted on Triality
0
Here are 2 approaches:
from starkware.cairo.common.alloc import alloc
let felt_array : felt* = alloc()
assert [felt_array] = 1
assert [felt_array+1] = 2
assert [felt_array+2] = 3
tempvar arr : felt* = new (1, 2, 3)
ㅤ This answer was originally posted on Triality
answered
6 months ago
Cairo: How do I iterate through an array of structs?
Cairo: How do write a log function in Cairo
Getting the CLASS_HASH of a contract in Cairo
Does cairo have payable functions?
Cairo Error calling function: Expected 'function_name' to be a struct. Found: 'function'.
How do you check if a number is even in Cairo?
Cairo: Getting the squared summation of felts in an array
Does anybody have an idea what is `get_caller_address` returning on an L1 handler call?
ApeWorX: How do I fund newly created accounts from the ape console?
Fixed Point pow operation error
Is there a way to find events in a block without getting receipt for all transactions on Starknet?
Why am I having trouble deploying my Cairo contract?
How to deploy a contract through starknet.py?
ApeWorX: Why am I getting an "account __execute__" error message?