keep-starknet-strange / ziggy-starkdust

⚡ Cairo VM in Zig ⚡
https://keep-starknet-strange.github.io/ziggy-starkdust/
MIT License
80 stars 39 forks source link

Move `computeRes` and `deduceOp1` to `Instruction` struct #451

Closed tcoratger closed 6 months ago

tcoratger commented 6 months ago

Description

This pull request focuses on enhancing the clarity and consistency of the Cairo VM main file by migrating remaining unit tests to a dedicated test file and restructuring certain functions for improved organization.

Migration of Unit Tests

The pull request migrates remaining unit tests from the Cairo VM main file to a dedicated test file. This migration enhances clarity and maintainability by separating test cases from the main implementation code.

Restructuring of Functions

Additionally, this pull request restructures the computeRes and deduceOp1 functions within the Instruction structure. Previously considered as isolated functions within the core file, these functions have been migrated inside the Instruction structure. This restructuring aligns with the principle of encapsulation, as these functions primarily concern operations involving an instruction and some other destination or op parameters. By organizing these functions within the Instruction structure, the codebase becomes more coherent and easier to navigate, promoting code readability and maintainability.