Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Threema/domain/libthreema/binding-tests/wasm/     Datei vom 25.3.2026 mit Größe 1 kB image not shown  

Quelle  utils.js

  Sprache: JAVA
 

import * as process from 'node:process';

import {init as initLibthreema} from '../../build/wasm/nodejs/libthreema.js';

export function assert(condition, message) {
    if (!condition) {
        throw new Error(`Assertion failed, message: ${message}`);
    }
}

export async function init() {
    const logTag = '[libthreema]';
    initLibthreema(
        {handle: (info) => console.error('PANIC!', info)},
        {
            debug: console.debug.bind(console, logTag),
            info: console.info.bind(console, logTag),
            warn: console.warn.bind(console, logTag),
            error: console.error.bind(console, logTag),
        },
        'debug',
    );
}

/**
 * Run a test and log information about passing or failure. Returns whether the
 * test passed.
 */

export function runTest(testFunction, name) {
    console.info('> �� Test', name);

    try {
        testFunction();
    } catch (error) {
        console.info('> ❌ Test', name, 'failed');
        console.error(error);
        return false;
    }

    console.info('> ✅ Test', name, 'passed');
    return true;
}

/**
 * Evaluate all tests results from {@link runTest} and exit the process
 * accordingly.
 */

export function evaluateTestResults(testResults) {
    const results = testResults.reduce(
        (results, passed) => {
            if (passed) {
                ++results.passed;
            } else {
                ++results.failed;
            }
            return results;
        },
        {passed: 0, failed: 0},
    );

    console.info(
        `${results.passed} tests passed, ${results.failed} tests failed`,
    );
    process.exit(results.failed === 0 ? 0 : 1);
}

Messung V0.5 in Prozent
C=96 H=96 G=95

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.