Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

aiken-extra/string_util

Repository files navigation

string_util

A utility library to pretty-print data, useful for tracing.

Important

This library is no longer maintained since Aiken v1.1.0, it accepts multiple trace arguments: aiken-lang/aiken#978

ℹ️ Package info aiken-extra/string_util v3.200.202409 🐞
🟢 Depends on aiken-lang/stdlib v2.0.0 ✔️
🟢 Tested with aiken v1.1.0 ✔️

Usage Example

use string_util/cbor.{print}
test should_unlock() {

    // arrange:
    let datum = datum.new(42)
    let redeemer = redeemer.new(42)

    // trace:
    trace print("Datum", datum)
    trace print("Redeemer", redeemer)

    // assert:
    unlock(datum, redeemer, 42)
}

will give something like,

    ┍━ lock_unlock/tests ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    │ PASS [mem: ####, cpu: ######] should_unlock
    │ ↳ Datum: "182a"
    │ ↳ Redeemer: "182a"
    │ PASS [mem: ####, cpu: ######] should_not_unlock
    │ ↳ Datum: "182a"
    │ ↳ Redeemer: "1818"
    ┕━━━━━━━━━━━━━━━━━━━━━━ 2 tests | 2 passed | 0 failed

About

An Aiken utility library to pretty-print data

Topics

Resources

License

Stars

Watchers

Forks

Languages