test: Expand Pi button test coverage
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -517,5 +517,73 @@ test('Operation with Pi', () => {
|
|||||||
checkDisplay(5 * Math.PI);
|
checkDisplay(5 * Math.PI);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Pi as second operand', () => {
|
||||||
|
press('2+p=');
|
||||||
|
checkDisplay(2 + Math.PI);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Chaining operations with Pi', () => {
|
||||||
|
press('p*2+3=');
|
||||||
|
checkDisplay(Math.PI * 2 + 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Unary operations on Pi', () => {
|
||||||
|
press('p');
|
||||||
|
checkDisplay(Math.PI);
|
||||||
|
press('r'); // sqrt
|
||||||
|
checkDisplay(Math.sqrt(Math.PI));
|
||||||
|
press('R'); press('R'); // AC
|
||||||
|
press('p');
|
||||||
|
press('s'); // x^2
|
||||||
|
checkDisplay(Math.PI * Math.PI);
|
||||||
|
press('R'); press('R'); // AC
|
||||||
|
press('p');
|
||||||
|
press('i'); // 1/x
|
||||||
|
checkDisplay(1 / Math.PI);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Trig functions with Pi (rad)', () => {
|
||||||
|
buttonPress('angleMode'); // switch to RAD
|
||||||
|
assert.strictEqual(scientificOperators.angleMode.val, 'rad');
|
||||||
|
|
||||||
|
press('p');
|
||||||
|
press('sin');
|
||||||
|
checkDisplay(Math.sin(Math.PI)); // ~0
|
||||||
|
press('R'); press('R');
|
||||||
|
|
||||||
|
press('p');
|
||||||
|
press('cos');
|
||||||
|
checkDisplay(Math.cos(Math.PI)); // -1
|
||||||
|
press('R'); press('R');
|
||||||
|
|
||||||
|
press('p');
|
||||||
|
press('tan');
|
||||||
|
checkDisplay(Math.tan(Math.PI)); // ~0
|
||||||
|
|
||||||
|
buttonPress('angleMode'); // switch back to DEG
|
||||||
|
assert.strictEqual(scientificOperators.angleMode.val, 'deg');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Pi after equals', () => {
|
||||||
|
press('1+2=');
|
||||||
|
checkDisplay(3);
|
||||||
|
press('p');
|
||||||
|
checkDisplay(Math.PI);
|
||||||
|
press('+1=');
|
||||||
|
checkDisplay(Math.PI + 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Pi with negative operator', () => {
|
||||||
|
press('pN');
|
||||||
|
checkDisplay(-Math.PI);
|
||||||
|
press('*2=');
|
||||||
|
checkDisplay(-Math.PI * 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Negative number times Pi', () => {
|
||||||
|
press('2N*p=');
|
||||||
|
checkDisplay(-2 * Math.PI);
|
||||||
|
});
|
||||||
|
|
||||||
// Run all the defined tests
|
// Run all the defined tests
|
||||||
runTests();
|
runTests();
|
||||||
|
|||||||
Reference in New Issue
Block a user