NEWTON
Asked
4 months ago
8
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
4 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
How do I move my Pathfinder node to another server / disk?
How to use Access Control in Cairo language securely?
How to check if a contract has been deployed at a certain address in cairo?
Why does Starkware pedersen Hash Function split numbers in high and low bits
Is Kakarot part of the Starknet ecosystem?
How to make Bitwise operations in Cairo Lang using %builtins bitwise, bitwise_xor?
ApeWorX: Why am I getting an "account __execute__" error message?