string_util

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

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

ℹī¸Package infoaiken-extra/string_util v3.200.202409🐞
đŸŸĸDepends onaiken-lang/stdlib v2.0.0✔ī¸
đŸŸĸTested withaiken 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
Search Document