diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6ee679f..7fa5e95 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4.1.7 - uses: aiken-lang/setup-aiken@v1 with: - version: v1.1.9 + version: v1.1.21 - run: aiken fmt --check - run: aiken check -D - run: aiken build diff --git a/README.md b/README.md index 3b251bc..5f5468d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ This library contains a set of tools, mainly for testing purposes: - [`print`](#print) (pretty-print data with label) -- [`to_data`](#to_data) (upcast any serialisable type to `Data`) - [`collections`](#collections) (contains some `list` and `zip3` functions) - [`fuzzy`](#fuzzy) (`address`, `assets`, `certificate`, `governance`, and `transaction` fuzzers) - [`time`](#time) (to `add`/`subtract` intervals and unwrapping finite time, taking its inclusivity into account) @@ -11,25 +10,24 @@ This library contains a set of tools, mainly for testing purposes: | ℹ️ | Package info | aiken-extra/test_kit | 🧰 | | --- | --------------- | ---------------------------------------------------------------------------------------- | --- | -| 🔴 | **Version** | **v0.0.2** | 🛠️ | -| 🔴 | **Codename** | **helium** | 🔥 | -| 🔴 | **Status** | **alpha** | 🧪 | -| 🟢 | **Depends on** | [**aiken-lang/fuzz v2.1.0**](https://github.com/aiken-lang/fuzz/releases/tag/v2.1.0) | ✅ | -| 🟢 | **Depends on** | [**aiken-lang/stdlib v2.2.0**](https://github.com/aiken-lang/stdlib/releases/tag/v2.2.0) | ✅ | -| 🟢 | **Tested with** | [**aiken v1.1.9**](https://github.com/aiken-lang/aiken/releases/tag/v1.1.9) | ✅ | +| 🟡 | **Version** | **v0.1.0** | 🛠️ | +| 🟡 | **Codename** | **lithium** | ☄️ | +| 🟡 | **Status** | **beta** | ⚗️ | +| 🟢 | **Depends on** | [**aiken-lang/fuzz v2.2.0**](https://github.com/aiken-lang/fuzz/releases/tag/v2.1.0) | ✅ | +| 🟢 | **Depends on** | [**aiken-lang/stdlib v3.0.0**](https://github.com/aiken-lang/stdlib/releases/tag/v2.2.0) | ✅ | +| 🟢 | **Tested with** | [**aiken v1.1.21**](https://github.com/aiken-lang/aiken/releases/tag/v1.1.9) | ✅ | - + - ## `print` Pretty-print data with label: -```gleam +```aiken use test_kit.{print} print("Label", data) // fuzz.label(@"Label: cbor.diagnostic(data)") @@ -38,21 +36,11 @@ print("Label", data) // fuzz.label(@"Label: cbor.diagnostic(data)") By calling [`fuzz.label`](https://aiken-lang.github.io/fuzz/aiken/fuzz.html#label) internally, `print` will also work with property testing. -## `to_data` - -Upcast any serialisable type to `Data`: - -```gleam -use test_kit.{to_data} - -any |> to_data // let data: Data = any -``` - ## `collections` Zip3: -```gleam +```aiken use test_kit/collections collections.zip3(list_a, list_b, list_c) // -> [(a, b, c)..] @@ -61,7 +49,7 @@ collections.unzip3(list_abc) // -> ([a..], [b..], [c..]) List `and` & `or`: -```gleam +```aiken use test_kit/collections/logic [..bools] |> logic.all_true // -> True | False @@ -72,15 +60,11 @@ use test_kit/collections/logic ## `fuzzy` -Tuple and unique fuzzers: +Unique fuzzers: -```gleam +```aiken use test_kit/fuzzy -// A convenient way of generating tuples instead of doing map: -test prop_tuple((a, b) via fuzzy.tuple(fuzzer_a, fuzzer_b)) { .. } -// also available: tuple3 to tuple9 - // Generates 3 unique elements from the given fuzzer: test prop_unique((x1, x2, x3) via fuzzy.unique3(fuzzer_x)) { .. } // other element counts are also available @@ -88,7 +72,7 @@ test prop_unique((x1, x2, x3) via fuzzy.unique3(fuzzer_x)) { .. } Transaction data fuzzers: -```gleam +```aiken use test_kit/fuzzy/fuzzer.{ .. } test prop_address(address via address_fuzzer(FromFuzzed, WithFuzzedDelegation)) { .. } // random addresses @@ -106,7 +90,7 @@ test prop_transaction(inputs via user_inputs_fuzzer()) { .. } // simple (non-scr Interval additions and subtractions: -```gleam +```aiken use test_kit/time.{ .. } interval.after(25200000) |> add_interval(lower_bound: 6 |> Minute, upper_bound: 5 |> Hour) // == interval.after(25200000 + 6 * 60 * 1_000) @@ -122,7 +106,7 @@ interval.between(4, 5000) |> sub_interval(lower_bound: 2 |> MS, upper_bound: 1 | Unwrapping finite time: -```gleam +```aiken use test_kit/time/unwrap unwrap.finite_start_of(interval) // -> PosixTime @@ -135,7 +119,7 @@ unwrap.finite_end_of(interval) // -> PosixTime Constructing transaction data: -```gleam +```aiken use test_kit/tx.{ .. } test validate_something() { @@ -155,7 +139,7 @@ test validate_something() { Mocking transaction data: -```gleam +```aiken use test_kit/tx/mock.{ .. } mock_address(from_payment: 1, from_stake: 2) diff --git a/aiken.lock b/aiken.lock index d3bfd2e..0a06f64 100644 --- a/aiken.lock +++ b/aiken.lock @@ -3,23 +3,23 @@ [[requirements]] name = "aiken-lang/stdlib" -version = "v2.2.0" +version = "3.0.0" source = "github" [[requirements]] name = "aiken-lang/fuzz" -version = "v2.1.0" +version = "2.2.0" source = "github" [[packages]] name = "aiken-lang/stdlib" -version = "v2.2.0" +version = "3.0.0" requirements = [] source = "github" [[packages]] name = "aiken-lang/fuzz" -version = "v2.1.0" +version = "2.2.0" requirements = [] source = "github" diff --git a/aiken.sh b/aiken.sh index 3472046..d522cd8 100755 --- a/aiken.sh +++ b/aiken.sh @@ -12,49 +12,10 @@ echo -e "${MAGENTA}Running${RESET} ${WHITE}aiken check${RESET}:" aiken c 2>&1 | tee ${PROJECT}.tests echo "" # new line -# aiken build -echo -e "${MAGENTA}Running${RESET} ${WHITE}aiken build${RESET}:" -aiken b $1 -echo "" # new line - -# aiken blueprint & address -echo -e "${MAGENTA}Running${RESET} ${WHITE}aiken blueprint${RESET} & ${WHITE}aiken address${RESET}:" -aiken blueprint convert > ${PROJECT}.plutus -aiken address > ${PROJECT}.address -echo "" # new line - # aiken docs -if [ $# -eq 0 ]; then - # README.md - GLEAM_CODE=("\`\`\`gleam") - AIKEN_CODE=("\`\`\`aiken") - - # README.md - aiken docs: preprocessing - replace ```gleam with ```aiken - README=() - while IFS= read -r LINE; do - if [ "$LINE" == "$GLEAM_CODE" ]; then - README+=("$AIKEN_CODE") - else - README+=("$LINE") - fi - done < README.md - printf "%s\n" "${README[@]}" > README.md - - # Running `aiken docs` - echo -e "${MAGENTA}Running${RESET} ${WHITE}aiken docs${RESET}:" - aiken docs - - # README.md - aiken docs: postprocessing - replace ```aiken with ```gleam - README=() - while IFS= read -r LINE; do - if [ "$LINE" == "$AIKEN_CODE" ]; then - README+=("$GLEAM_CODE") - else - README+=("$LINE") - fi - done < README.md - printf "%s\n" "${README[@]}" > README.md -fi +# Running `aiken docs` +echo -e "${MAGENTA}Running${RESET} ${WHITE}aiken docs${RESET}:" +aiken docs # .gitignore GITIGNORE=() diff --git a/aiken.toml b/aiken.toml index de6161a..7a116ba 100644 --- a/aiken.toml +++ b/aiken.toml @@ -1,6 +1,6 @@ name = "aiken-extra/test_kit" -version = "helium-α" -compiler = "v1.1.9" +version = "lithium-β" +compiler = "1.1.21" plutus = "v3" license = "Apache-2.0" description = "An Aiken utility library containing various tools, mainly for testing purposes" @@ -12,12 +12,13 @@ platform = "github" [[dependencies]] name = "aiken-lang/stdlib" -version = "v2.2.0" +version = "3.0.0" source = "github" [[dependencies]] name = "aiken-lang/fuzz" -version = "v2.1.0" +version = "2.2.0" source = "github" -[config] +[config.default] +now = 1768998897000 diff --git a/docs/config.html b/docs/config.html new file mode 100644 index 0000000..7406186 --- /dev/null +++ b/docs/config.html @@ -0,0 +1,468 @@ + + +
+ + +