feat: Replace percent button with Pi button, update logic and tests
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
+17
-1
@@ -330,7 +330,6 @@ const unaryOps = {
|
||||
'r': { name: 'sqrt', fn: Math.sqrt },
|
||||
's': { name: 'x^2', fn: (a) => a * a },
|
||||
'i': { name: '1/x', fn: (a) => 1 / a },
|
||||
'%': { name: '%', fn: (a) => a / 100 },
|
||||
};
|
||||
|
||||
for (const op in unaryOps) {
|
||||
@@ -501,5 +500,22 @@ test('Negative zero handling', () => {
|
||||
checkDisplay(-0);
|
||||
});
|
||||
|
||||
test('Pi button', () => {
|
||||
press('p');
|
||||
checkDisplay(Math.PI);
|
||||
press('*2=');
|
||||
checkDisplay(Math.PI * 2);
|
||||
});
|
||||
|
||||
test('Pi replaces current number entry', () => {
|
||||
press('123p');
|
||||
checkDisplay(Math.PI);
|
||||
});
|
||||
|
||||
test('Operation with Pi', () => {
|
||||
press('5*p=');
|
||||
checkDisplay(5 * Math.PI);
|
||||
});
|
||||
|
||||
// Run all the defined tests
|
||||
runTests();
|
||||
|
||||
Reference in New Issue
Block a user