mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2026-01-06 20:12:39 +01:00
Refactor and enable bits flipping in bitwise expression
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import calc from './calc';
|
||||
import { BitwiseOperationExpression, ScalarExpression, OperatorExpression } from '../expression/expression';
|
||||
import { BitwiseOperationExpression, ScalarToken, OperatorToken } from '../expression/expression';
|
||||
import exp from 'constants';
|
||||
import { INT_MAX_VALUE } from './const';
|
||||
import formatter from './formatter';
|
||||
@@ -23,9 +23,9 @@ describe("calc", () => {
|
||||
var result = calc.calcExpression(new BitwiseOperationExpression(
|
||||
"1|2&3",
|
||||
[
|
||||
new ScalarExpression(1),
|
||||
new OperatorExpression(new ScalarExpression(2), "|"),
|
||||
new OperatorExpression(new ScalarExpression(3), "&"),
|
||||
new ScalarToken(1),
|
||||
new OperatorToken(new ScalarToken(2), "|"),
|
||||
new OperatorToken(new ScalarToken(3), "&"),
|
||||
]
|
||||
));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dblClick } from "@testing-library/user-event/dist/click";
|
||||
import { ExpressionInput } from "../expression/expression-interfaces";
|
||||
import { Expression } from "../expression/expression-interfaces";
|
||||
import { INT_MAX_VALUE } from "./const";
|
||||
import { start } from "repl";
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
return Math.max.apply(null, counts);
|
||||
},
|
||||
|
||||
calcExpression: function (expr: ExpressionInput) {
|
||||
calcExpression: function (expr: Expression) {
|
||||
return eval(expr.expressionString);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user