- Added port_mass_flows to Component trait and implements for core components. - Added System::check_mass_balance and integrated it into the solver. - Restored connect methods for ExpansionValve, Compressor, and Pipe to fix integration tests. - Updated Python and C bindings for validation errors. - Updated sprint status and story documentation.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
const { default: init, version, list_available_fluids, WasmSystem, WasmPressure, WasmTemperature, WasmFallbackConfig } = require('../pkg/entropyk_wasm.js');
|
|
|
|
async function main() {
|
|
// Initialize WASM module
|
|
await init();
|
|
|
|
console.log('Entropyk WASM Test');
|
|
console.log('===================');
|
|
console.log('Version:', version());
|
|
|
|
// Test fluid listing
|
|
const fluids = list_available_fluids();
|
|
console.log('Available fluids:', fluids);
|
|
|
|
// Test pressure creation
|
|
const p = new WasmPressure(101325.0);
|
|
console.log('Pressure (Pa):', p.pascals());
|
|
console.log('Pressure (bar):', p.bar());
|
|
|
|
// Test temperature creation
|
|
const t = WasmTemperature.from_celsius(25.0);
|
|
console.log('Temperature (K):', t.kelvin());
|
|
console.log('Temperature (°C):', t.celsius());
|
|
|
|
// Test system creation
|
|
const system = new WasmSystem();
|
|
console.log('System created');
|
|
console.log('Node count:', system.node_count());
|
|
console.log('Edge count:', system.edge_count());
|
|
|
|
// Test solver configuration
|
|
const config = new WasmFallbackConfig();
|
|
config.timeout_ms(1000);
|
|
|
|
// Test JSON output
|
|
console.log('System JSON:', system.toJson());
|
|
|
|
console.log('\nAll tests passed!');
|
|
}
|
|
|
|
main().catch(err => {
|
|
console.error('Test failed:', err);
|
|
process.exit(1);
|
|
});
|