mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
17 lines
782 B
JavaScript
17 lines
782 B
JavaScript
// test conj
|
|
var assert = require('assert');
|
|
var math = require('../../../math.js');
|
|
|
|
assert.equal(math.conj(math.complex('2 + 3i')).toString(), '2 - 3i');
|
|
assert.equal(math.conj(123).toString(), '123');
|
|
assert.equal(math.conj(math.complex('2 - 3i')).toString(), '2 + 3i');
|
|
assert.equal(math.conj(math.complex('2')).toString(), '2');
|
|
assert.equal(math.conj(math.complex('-4i')).toString(), '4i');
|
|
assert.equal(math.conj(math.i).toString(), '-i');
|
|
assert.equal(math.format(math.conj([math.complex('2+3i'), math.complex('3-4i')])),
|
|
'[2 - 3i, 3 + 4i]');
|
|
assert.equal(math.conj(math.matrix([math.complex('2+3i'), math.complex('3-4i')])).toString(),
|
|
'[2 - 3i, 3 + 4i]');
|
|
assert.throws(function() {math.conj('string') });
|
|
assert.throws(function() {math.conj(math.unit('5cm')) });
|