Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucas-manuel/invariant-examples
https://github.com/lucas-manuel/invariant-examples
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lucas-manuel/invariant-examples
- Owner: lucas-manuel
- Created: 2022-12-31T17:19:31.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-30T22:51:25.000Z (over 1 year ago)
- Last Synced: 2024-12-11T22:34:03.014Z (about 2 months ago)
- Language: Solidity
- Size: 33.2 KB
- Stars: 163
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-foundry - Invariant Examples - This repository functions as an accessible example for Foundry developers to experiment and learn about invariant testing. (Templates & Libraries)
README
# Invariant Examples
[![Foundry][foundry-badge]][foundry]
[foundry]: https://getfoundry.sh/
[foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg## Overview
This repository functions as an accessible example for Foundry developers to experiment and learn about invariant testing.
This repository is a work in progress, and will be updated continuously.
Issues with suggestions are encouraged!## Setup
This project was built using [Foundry](https://book.getfoundry.sh/). Refer to installation instructions [here](https://github.com/foundry-rs/foundry#installation).
```sh
git clone [email protected]:lucas-manuel/invariant-example.git
cd invariant-example
forge install
```## Running Tests
Foundry considers all functions that start with `invariant_` to be invariant tests. To run them, you can use the following commands:
- To run open invariant tests: `make open-invariant`
- To run bounded invariant tests: `make bounded-invariant`
- To run unbounded invariant tests: `make unbounded-invariant`## Call Summaries
`invariant_call_summary` functions are not invariants, they are used to illustrate how the probability distribution of function calls within a given invariant test works.