[K/Wasm] Generate .d.ts tests for K/Wasm in the same way as we do for K/JS ^KT-65778 Fixed

This commit is contained in:
Artem Kobzar
2024-03-05 15:33:56 +00:00
committed by Space Team
parent c2023142f5
commit 8d4948c3ee
310 changed files with 1643 additions and 1370 deletions
@@ -1,48 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function getResult(): not.exported.org.second.Result<string>;
declare namespace not.exported.org.second {
class Result<T extends NonNullable<unknown>> extends not.exported.org.second.BaseResult<T> {
constructor();
}
}
declare namespace not.exported.org.second {
abstract class BaseResult<T extends NonNullable<unknown>> {
constructor(foo: typeof not.exported.org.second.Foo);
}
}
declare namespace not.exported.org.second {
const Foo: {
get bar(): not.exported.Parent.OneMoreLayer.MentionedNested;
get baz(): string;
get oneMore(): not.exported.Parent.Companion.AnotherMentionedNested;
} & not.exported.Baz<string>;
}
declare namespace not.exported {
interface Baz<T> extends not.exported.Bar {
readonly baz?: T;
readonly bar: not.exported.Parent.OneMoreLayer.MentionedNested;
readonly oneMore: not.exported.Parent.Companion.AnotherMentionedNested;
}
}
declare namespace not.exported.Parent.OneMoreLayer {
interface MentionedNested {
readonly value: typeof not.exported.MentionedParent;
}
}
declare namespace not.exported.Parent.Companion {
class AnotherMentionedNested {
constructor();
get value(): string;
}
}
declare namespace not.exported {
interface Bar {
readonly bar: not.exported.Parent.OneMoreLayer.MentionedNested;
readonly oneMore: not.exported.Parent.Companion.AnotherMentionedNested;
}
}
declare namespace not.exported {
const MentionedParent: {
get value(): string;
};
}
@@ -1,60 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: first.kt
external object MentionedParent {
val value: String
interface Nested {
val value: Int
}
}
external class Parent {
object OneMoreLayer {
interface MentionedNested {
val value: MentionedParent
}
}
companion object {
class AnotherMentionedNested {
val value: String
}
}
}
external interface Bar {
val bar: Parent.OneMoreLayer.MentionedNested
val oneMore: Parent.Companion.AnotherMentionedNested
}
external interface Baz<T: JsAny?> : Bar {
val baz: T
}
// FILE: second.kt
package org.second
import Bar
import Baz
external object Foo : Baz<JsString> {
override val bar: Parent.OneMoreLayer.MentionedNested
override val baz: JsString
override val oneMore: Parent.Companion.AnotherMentionedNested
}
external abstract class BaseResult<T: JsAny>(foo: Foo)
external class Result<T: JsAny> : BaseResult<T>
fun getResultInternal(): Result<JsString> = js("({})")
@JsExport
fun getResult(): Result<JsString> = getResultInternal()
// FILE: entry.mjs
import { getResult } from "./index.mjs";
if (JSON.stringify(getResult()) != "{}") throw new Error("Unexpected result")
@@ -1,20 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function simple<T>(x: T): T;
export declare function second<A, B>(a: A, b: B): B;
export declare function simpleWithConstraint<T extends number>(x: T): T;
export declare function complexConstraint<A extends not.exported.Foo<bigint> & not.exported.Bar, B extends typeof not.exported.Baz>(x: A): B;
declare namespace not.exported {
interface Foo<T extends NonNullable<unknown>> {
readonly foo: T;
}
}
declare namespace not.exported {
interface Bar {
readonly bar: string;
}
}
declare namespace not.exported {
const Baz: {
get baz(): boolean;
};
}
@@ -1,39 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: generics.kt
@JsExport
fun <T: JsAny?> simple(x: T): T = x
@JsExport
fun <A: JsAny?, B: JsAny?> second(a: A, b: B): B = b
@JsExport
fun <T: JsNumber> simpleWithConstraint(x: T): T = x
external interface Foo<T: JsAny> : JsAny {
val foo: T
}
external interface Bar : JsAny {
val bar: JsString
}
external object Baz : JsAny {
val baz: JsBoolean
}
fun getBaz(x: Foo<JsBigInt>): JsAny = js("({ baz: x.foo > 0n })")
@JsExport
fun <A, B> complexConstraint(x: A): B where A: Foo<JsBigInt>, A: Bar, B: Baz = getBaz(x).unsafeCast<B>()
// FILE: entry.mjs
import { simple, second, simpleWithConstraint, complexConstraint } from "./index.mjs";
if (simple("OK") != "OK") throw new Error("Unexpected result from `simple` function")
if (second(1, "OK") != "OK") throw new Error("Unexpected result from `second` function")
if (simpleWithConstraint(42) != 42) throw new Error("Unexpected result from `simpleConstraint` function")
if (JSON.stringify(complexConstraint({ foo: 1n, bar: "bar" })) != "{\"baz\":true}") throw new Error("Unexpected result from `complexConstraint` function")
@@ -1,11 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceBoolean(): boolean;
export declare function produceNumber(): number;
export declare function produceBigInt(): bigint;
export declare function produceString(): string;
export declare function produceAny(): NonNullable<unknown>;
export declare function consumeBoolean(x: boolean): string;
export declare function consumeNumber(x: number): string;
export declare function consumeBigInt(x: bigint): string;
export declare function consumeString(x: string): string;
export declare function consumeAny(x: NonNullable<unknown>): string;
@@ -1,61 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: jsPrimitives.kt
@JsExport
fun produceBoolean(): JsBoolean = true.toJsBoolean()
@JsExport
fun produceNumber(): JsNumber = Int.MAX_VALUE.toJsNumber()
@JsExport
fun produceBigInt(): JsBigInt = Long.MAX_VALUE.toJsBigInt()
@JsExport
fun produceString(): JsString = "OK".toJsString()
@JsExport
fun produceAny(): JsAny = 42.toJsNumber()
@JsExport
fun consumeBoolean(x: JsBoolean): String = x.toBoolean().toString()
@JsExport
fun consumeNumber(x: JsNumber): String = x.toInt().toString()
@JsExport
fun consumeBigInt(x: JsBigInt): String = x.toLong().toString()
@JsExport
fun consumeString(x: JsString): String = x.toString()
@JsExport
fun consumeAny(x: JsAny): String = x.toString()
// FILE: entry.mjs
import {
produceBoolean,
produceNumber,
produceBigInt,
produceString,
produceAny,
consumeBoolean,
consumeNumber,
consumeBigInt,
consumeAny
} from "./index.mjs"
// PRODUCING
if (!produceBoolean()) throw new Error("Unexpected value was returned from the `produceBoolean` function")
if (produceNumber() != 2147483647) throw new Error("Unexpected value was returned from the `produceNumber` function")
if (produceBigInt() != 9223372036854775807n) throw new Error("Unexpected value was returned from the `produceBigInt` function")
if (produceString() != "OK") throw new Error("Unexpected value was returned from the `produceString` function")
if (produceAny() != 42) throw new Error("Unexpected value was returned from the `produceAny` function")
// CONSUMPTION
if (consumeBoolean(false) != "false") throw new Error("Unexpected value was returned from the `consumeBoolean` function")
if (consumeNumber(-2147483648) != "-2147483648") throw new Error("Unexpected value was returned from the `consumeNumber` function")
if (consumeBigInt(-9223372036854775808n) != "-9223372036854775808") throw new Error("Unexpected value was returned from the `consumeBigInt` function")
if (consumeAny(24) != 24) throw new Error("Unexpected value was returned from the `consumeAny` function")
@@ -1,11 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceBoolean(): Nullable<boolean>;
export declare function produceNumber(): Nullable<number>;
export declare function produceBigInt(): Nullable<bigint>;
export declare function produceString(): Nullable<string>;
export declare function produceAny(): unknown;
export declare function consumeBoolean(x: Nullable<boolean>): Nullable<string>;
export declare function consumeNumber(x: Nullable<number>): Nullable<string>;
export declare function consumeBigInt(x: Nullable<bigint>): Nullable<string>;
export declare function consumeString(x: Nullable<string>): Nullable<string>;
export declare function consumeAny(x: unknown): Nullable<string>;
@@ -1,61 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: nullableJsPrimitives.kt
@JsExport
fun produceBoolean(): JsBoolean? = true.toJsBoolean()
@JsExport
fun produceNumber(): JsNumber? = Int.MAX_VALUE.toJsNumber()
@JsExport
fun produceBigInt(): JsBigInt? = Long.MAX_VALUE.toJsBigInt()
@JsExport
fun produceString(): JsString? = "OK".toJsString()
@JsExport
fun produceAny(): JsAny? = 42.toJsNumber()
@JsExport
fun consumeBoolean(x: JsBoolean?): String? = x?.toBoolean()?.toString()
@JsExport
fun consumeNumber(x: JsNumber?): String? = x?.toInt()?.toString()
@JsExport
fun consumeBigInt(x: JsBigInt?): String? = x?.toLong()?.toString()
@JsExport
fun consumeString(x: JsString?): String? = x?.toString()
@JsExport
fun consumeAny(x: JsAny?): String? = x?.toString()
// FILE: entry.mjs
import {
produceBoolean,
produceNumber,
produceBigInt,
produceString,
produceAny,
consumeBoolean,
consumeNumber,
consumeBigInt,
consumeAny,
} from "./index.mjs"
// PRODUCING
if (!produceBoolean()) throw new Error("Unexpected value was returned from the `produceBoolean` function")
if (produceNumber() != 2147483647) throw new Error("Unexpected value was returned from the `produceNumber` function")
if (produceBigInt() != 9223372036854775807n) throw new Error("Unexpected value was returned from the `produceBigInt` function")
if (produceString() != "OK") throw new Error("Unexpected value was returned from the `produceString` function")
if (produceAny() != 42) throw new Error("Unexpected value was returned from the `produceAny` function")
// CONSUMPTION
if (consumeBoolean(false) != "false") throw new Error("Unexpected value was returned from the `consumeBoolean` function")
if (consumeNumber(-2147483648) != "-2147483648") throw new Error("Unexpected value was returned from the `consumeNumber` function")
if (consumeBigInt(-9223372036854775808n) != "-9223372036854775808") throw new Error("Unexpected value was returned from the `consumeBigInt` function")
if (consumeAny(24) != 24) throw new Error("Unexpected value was returned from the `consumeAny` function")
@@ -1,17 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceBoolean(): Nullable<boolean>;
export declare function produceByte(): Nullable<number>;
export declare function produceShort(): Nullable<number>;
export declare function produceInt(): Nullable<number>;
export declare function produceLong(): Nullable<bigint>;
export declare function produceChar(): Nullable<number>;
export declare function produceString(): Nullable<string>;
export declare function produceFunction(): Nullable<() => number>;
export declare function consumeBoolean(x: Nullable<boolean>): Nullable<string>;
export declare function consumeByte(x: Nullable<number>): Nullable<string>;
export declare function consumeShort(x: Nullable<number>): Nullable<string>;
export declare function consumeInt(x: Nullable<number>): Nullable<string>;
export declare function consumeLong(x: Nullable<bigint>): Nullable<string>;
export declare function consumeChar(x: Nullable<number>): Nullable<string>;
export declare function consumeString(x: Nullable<string>): Nullable<string>;
export declare function consumeFunction(fn: Nullable<(p0: string) => number>): Nullable<number>;
@@ -1,93 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: nullablePrimitives.kt
@JsExport
fun produceBoolean(): Boolean? = true
@JsExport
fun produceByte(): Byte? = Byte.MAX_VALUE
@JsExport
fun produceShort(): Short? = Short.MAX_VALUE
@JsExport
fun produceInt(): Int? = Int.MAX_VALUE
@JsExport
fun produceLong(): Long? = Long.MAX_VALUE
@JsExport
fun produceChar(): Char? = 'a'
@JsExport
fun produceString(): String? = "OK"
@JsExport
fun produceFunction(): (() -> Int)? = { 42 }
@JsExport
fun consumeBoolean(x: Boolean?): String? = x?.toString()
@JsExport
fun consumeByte(x: Byte?): String? = x?.toString()
@JsExport
fun consumeShort(x: Short?): String? = x?.toString()
@JsExport
fun consumeInt(x: Int?): String? = x?.toString()
@JsExport
fun consumeLong(x: Long?): String? = x?.toString()
@JsExport
fun consumeChar(x: Char?): String? = x?.toString()
@JsExport
fun consumeString(x: String?): String? = x
@JsExport
fun consumeFunction(fn: ((String) -> Int)?): Int? = fn?.invoke("42")
// FILE: entry.mjs
import {
produceBoolean,
produceByte,
produceShort,
produceInt,
produceLong,
produceChar,
produceString,
produceFunction,
consumeBoolean,
consumeByte,
consumeShort,
consumeInt,
consumeLong,
consumeChar,
consumeString,
consumeFunction,
} from "./index.mjs"
// PRODUCING
if (!produceBoolean()) throw new Error("Unexpected value was returned from the `produceBoolean` function")
if (produceByte() != 127) throw new Error("Unexpected value was returned from the `produceByte` function")
if (produceShort() != 32767) throw new Error("Unexpected value was returned from the `produceShort` function")
if (produceInt() != 2147483647) throw new Error("Unexpected value was returned from the `produceInt` function")
if (produceLong() != 9223372036854775807n) throw new Error("Unexpected value was returned from the `produceLong` function")
if (String.fromCharCode(produceChar()) != "a") throw new Error("Unexpected value was returned from the `produceChar` function")
if (produceString() != "OK") throw new Error("Unexpected value was returned from the `produceString` function")
if (produceFunction()() != 42) throw new Error("Unexpected value was returned from the `produceFunction` function")
// CONSUMPTION
if (consumeBoolean(false) != "false") throw new Error("Unexpected value was returned from the `consumeBoolean` function")
if (consumeByte(-128) != "-128") throw new Error("Unexpected value was returned from the `consumeByte` function")
if (consumeShort(-32768) != "-32768") throw new Error("Unexpected value was returned from the `consumeShort` function")
if (consumeInt(-2147483648) != "-2147483648") throw new Error("Unexpected value was returned from the `consumeInt` function")
if (consumeLong(-9223372036854775808n) != "-9223372036854775808") throw new Error("Unexpected value was returned from the `consumeLong` function")
if (consumeChar("b".charCodeAt()) != "b") throw new Error("Unexpected value was returned from the `consumeChar` function")
if (consumeString("🙂") != "🙂") throw new Error("Unexpected value was returned from the `consumeString` function")
if (consumeFunction(parseInt) != 42) throw new Error("Unexpected value was returned from the `consumeFunction` function")
@@ -1,11 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceUByte(): Nullable<number>;
export declare function produceUShort(): Nullable<number>;
export declare function produceUInt(): Nullable<number>;
export declare function produceULong(): Nullable<bigint>;
export declare function produceFunction(): () => Nullable<number>;
export declare function consumeUByte(x: Nullable<number>): Nullable<string>;
export declare function consumeUShort(x: Nullable<number>): Nullable<string>;
export declare function consumeUInt(x: Nullable<number>): Nullable<string>;
export declare function consumeULong(x: Nullable<bigint>): Nullable<string>;
export declare function consumeFunction(fn: (p0: string) => Nullable<number>): Nullable<number>;
@@ -1,63 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: nullableUnsigned.kt
@JsExport
fun produceUByte(): UByte? = UByte.MAX_VALUE
@JsExport
fun produceUShort(): UShort? = UShort.MAX_VALUE
@JsExport
fun produceUInt(): UInt? = UInt.MAX_VALUE
@JsExport
fun produceULong(): ULong? = ULong.MAX_VALUE
@JsExport
fun produceFunction(): () -> UInt? = ::produceUInt
@JsExport
fun consumeUByte(x: UByte?): String? = x?.toString()
@JsExport
fun consumeUShort(x: UShort?): String? = x?.toString()
@JsExport
fun consumeUInt(x: UInt?): String? = x?.toString()
@JsExport
fun consumeULong(x: ULong?): String? = x?.toString()
@JsExport
fun consumeFunction(fn: (String) -> UInt?): UInt? = fn("42")
// FILE: entry.mjs
import {
produceUByte,
produceUShort,
produceUInt,
produceULong,
produceFunction,
consumeUByte,
consumeUShort,
consumeUInt,
consumeULong,
consumeFunction,
} from "./index.mjs"
// PRODUCING
if (produceUByte() != 255) throw new Error("Unexpected value was returned from the `produceUByte` function")
if (produceUShort() != 65535) throw new Error("Unexpected value was returned from the `produceUShort` function")
if (produceUInt() != 4294967295) throw new Error("Unexpected value was returned from the `produceUInt` function")
if (produceULong() != 18446744073709551615n) throw new Error("Unexpected value was returned from the `produceULong` function")
if (produceFunction()() != 4294967295) throw new Error("Unexpected value was returned from the `produceFunction` function")
// CONSUMPTION
if (consumeUByte(-128) != "128") throw new Error("Unexpected value was returned from the `consumeUByte` function")
if (consumeUShort(-32768) != "32768") throw new Error("Unexpected value was returned from the `consumeUShort` function")
if (consumeUInt(-2147483648) != "2147483648") throw new Error("Unexpected value was returned from the `consumeUInt` function")
if (consumeULong(-9223372036854775808n) != "9223372036854775808") throw new Error("Unexpected value was returned from the `consumeULong` function")
if (consumeFunction(parseInt) != 42) throw new Error("Unexpected value was returned from the `consumeFunction` function")
@@ -1,19 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceBoolean(): boolean;
export declare function produceByte(): number;
export declare function produceShort(): number;
export declare function produceInt(): number;
export declare function produceLong(): bigint;
export declare function produceChar(): number;
export declare function produceString(): string;
export declare function getState(): string;
export declare function mutateState(): void;
export declare function produceFunction(): () => number;
export declare function consumeBoolean(x: boolean): string;
export declare function consumeByte(x: number): string;
export declare function consumeShort(x: number): string;
export declare function consumeInt(x: number): string;
export declare function consumeLong(x: bigint): string;
export declare function consumeChar(x: number): string;
export declare function consumeString(x: string): string;
export declare function consumeFunction(fn: (p0: string) => number): number;
@@ -1,108 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: primitives.kt
@JsExport
fun produceBoolean(): Boolean = true
@JsExport
fun produceByte(): Byte = Byte.MAX_VALUE
@JsExport
fun produceShort(): Short = Short.MAX_VALUE
@JsExport
fun produceInt(): Int = Int.MAX_VALUE
@JsExport
fun produceLong(): Long = Long.MAX_VALUE
@JsExport
fun produceChar(): Char = 'a'
@JsExport
fun produceString(): String = "OK"
private var state = "INITIAL"
@JsExport
fun getState(): String = state
@JsExport
fun mutateState() {
state = "MUTATED"
}
@JsExport
fun produceFunction(): () -> Int = ::produceInt
@JsExport
fun consumeBoolean(x: Boolean): String = x.toString()
@JsExport
fun consumeByte(x: Byte): String = x.toString()
@JsExport
fun consumeShort(x: Short): String = x.toString()
@JsExport
fun consumeInt(x: Int): String = x.toString()
@JsExport
fun consumeLong(x: Long): String = x.toString()
@JsExport
fun consumeChar(x: Char): String = x.toString()
@JsExport
fun consumeString(x: String): String = x
@JsExport
fun consumeFunction(fn: (String) -> Int): Int = fn("42")
// FILE: entry.mjs
import {
produceBoolean,
produceByte,
produceShort,
produceInt,
produceLong,
produceChar,
produceString,
getState,
mutateState,
produceFunction,
consumeBoolean,
consumeByte,
consumeShort,
consumeInt,
consumeLong,
consumeChar,
consumeString,
consumeFunction,
} from "./index.mjs"
// PRODUCING
if (!produceBoolean()) throw new Error("Unexpected value was returned from the `produceBoolean` function")
if (produceByte() != 127) throw new Error("Unexpected value was returned from the `produceByte` function")
if (produceShort() != 32767) throw new Error("Unexpected value was returned from the `produceShort` function")
if (produceInt() != 2147483647) throw new Error("Unexpected value was returned from the `produceInt` function")
if (produceLong() != 9223372036854775807n) throw new Error("Unexpected value was returned from the `produceLong` function")
if (String.fromCharCode(produceChar()) != "a") throw new Error("Unexpected value was returned from the `produceChar` function")
if (produceString() != "OK") throw new Error("Unexpected value was returned from the `produceString` function")
if (getState() != "INITIAL") throw new Error("Unexpected value was returned from the `getState` function before the mutation")
mutateState()
if (getState() != "MUTATED") throw new Error("Unexpected value was returned from the `getState` function after the mutation")
if (produceFunction()() != 2147483647) throw new Error("Unexpected value was returned from the `produceFunction` function")
// CONSUMPTION
if (consumeBoolean(false) != "false") throw new Error("Unexpected value was returned from the `consumeBoolean` function")
if (consumeByte(-128) != "-128") throw new Error("Unexpected value was returned from the `consumeByte` function")
if (consumeShort(-32768) != "-32768") throw new Error("Unexpected value was returned from the `consumeShort` function")
if (consumeInt(-2147483648) != "-2147483648") throw new Error("Unexpected value was returned from the `consumeInt` function")
if (consumeLong(-9223372036854775808n) != "-9223372036854775808") throw new Error("Unexpected value was returned from the `consumeLong` function")
if (consumeChar("b".charCodeAt()) != "b") throw new Error("Unexpected value was returned from the `consumeChar` function")
if (consumeString("🙂") != "🙂") throw new Error("Unexpected value was returned from the `consumeString` function")
if (consumeFunction(parseInt) != 42) throw new Error("Unexpected value was returned from the `consumeFunction` function")
@@ -1,11 +0,0 @@
type Nullable<T> = T | null | undefined
export declare function produceUByte(): number;
export declare function produceUShort(): number;
export declare function produceUInt(): number;
export declare function produceULong(): bigint;
export declare function produceFunction(): () => number;
export declare function consumeUByte(x: number): string;
export declare function consumeUShort(x: number): string;
export declare function consumeUInt(x: number): string;
export declare function consumeULong(x: bigint): string;
export declare function consumeFunction(fn: (p0: string) => number): number;
@@ -1,63 +0,0 @@
// CHECK_TYPESCRIPT_DECLARATIONS
// TARGET_BACKEND: WASM
// MODULE: main
// FILE: unsigned.kt
@JsExport
fun produceUByte(): UByte = UByte.MAX_VALUE
@JsExport
fun produceUShort(): UShort = UShort.MAX_VALUE
@JsExport
fun produceUInt(): UInt = UInt.MAX_VALUE
@JsExport
fun produceULong(): ULong = ULong.MAX_VALUE
@JsExport
fun produceFunction(): () -> UInt = ::produceUInt
@JsExport
fun consumeUByte(x: UByte): String = x.toString()
@JsExport
fun consumeUShort(x: UShort): String = x.toString()
@JsExport
fun consumeUInt(x: UInt): String = x.toString()
@JsExport
fun consumeULong(x: ULong): String = x.toString()
@JsExport
fun consumeFunction(fn: (String) -> UInt): UInt = fn("42")
// FILE: entry.mjs
import {
produceUByte,
produceUShort,
produceUInt,
produceULong,
produceFunction,
consumeUByte,
consumeUShort,
consumeUInt,
consumeULong,
consumeFunction,
} from "./index.mjs"
// PRODUCING
if (produceUByte() != 255) throw new Error("Unexpected value was returned from the `produceUByte` function")
if (produceUShort() != 65535) throw new Error("Unexpected value was returned from the `produceUShort` function")
if (produceUInt() != 4294967295) throw new Error("Unexpected value was returned from the `produceUInt` function")
if (produceULong() != 18446744073709551615n) throw new Error("Unexpected value was returned from the `produceULong` function")
if (produceFunction()() != 4294967295) throw new Error("Unexpected value was returned from the `produceFunction` function")
// CONSUMPTION
if (consumeUByte(-128) != "128") throw new Error("Unexpected value was returned from the `consumeUByte` function")
if (consumeUShort(-32768) != "32768") throw new Error("Unexpected value was returned from the `consumeUShort` function")
if (consumeUInt(-2147483648) != "2147483648") throw new Error("Unexpected value was returned from the `consumeUInt` function")
if (consumeULong(-9223372036854775808n) != "9223372036854775808") throw new Error("Unexpected value was returned from the `consumeULong` function")
if (consumeFunction(parseInt) != 42) throw new Error("Unexpected value was returned from the `consumeFunction` function")