support of negative values

This commit is contained in:
Borys Levytskyi
2015-04-11 23:46:56 +03:00
parent 491141e618
commit b7ea2545bb
3 changed files with 21 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ describe("expression parse", function() {
});
var listCases = {
'-0xa -9' : [-10, -9],
'1 2 3': [1, 2, 3],
'0x1 2 0xa6b': [0x1, 2, 0xa6b],
'0x11a': [0x11a]
@@ -68,6 +69,17 @@ describe('create operands', function() {
rundOperandsTest(hexOperand, decOperand);
});
describe('negative operands', function () {
var op = expression.parseOperand('-0xa');
it('shoold have correct values', function() {
expect(op.value).toBe(-10);
expect(op.hex).toBe('-0xa');
expect(op.bin).toBe('11111111111111111111111111110110');
expect(op.dec).toBe('-10');
expect(op.kind).toBe('hex');
})
});
function rundOperandsTest(hexOperand, decOperand) {
it('should remember input form', function() {
expect(hexOperand.input).toBe('0x10');