mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-10 06:52:05 +01:00
Fixed bug in shift operation
This commit is contained in:
@@ -127,12 +127,12 @@
|
|||||||
<table class="expression">
|
<table class="expression">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label">{m.operand1.input}</td>
|
<td class="label">{m.operand1.input}</td>
|
||||||
<td class="bin">{m.operand1Binary}</td>
|
<td class="bin">{m.operand1.bin.padLeft(m.bitsSize, '0')}</td>
|
||||||
<td class="other">{m.operand1.other}</td>
|
<td class="other">{m.operand1.other}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="result">
|
<tr class="result">
|
||||||
<td class="label">{m.string.replace(/\s/g,'')}={m.result.input}</td>
|
<td class="label">{m.string.replace(/\s/g,'')}={m.result.input}</td>
|
||||||
<td class="bin">{m.resultBinary}</td>
|
<td class="bin">{m.result.bin.padLeft(m.bitsSize, '0')}</td>
|
||||||
<td class="other">{m.result.other}</td>
|
<td class="other">{m.result.other}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ describe('launch of application', function() {
|
|||||||
.then(function() { return sendCommand('0x1 0xf')})
|
.then(function() { return sendCommand('0x1 0xf')})
|
||||||
.then(function() { return sendCommand('0x1 | 0xf')})
|
.then(function() { return sendCommand('0x1 | 0xf')})
|
||||||
.then(function() { return sendCommand('0x1 ^ 123')})
|
.then(function() { return sendCommand('0x1 ^ 123')})
|
||||||
.then(function() { return sendCommand('em')})
|
|
||||||
.then(function() { return sendCommand('em')})
|
|
||||||
.then(function() { return sendCommand('dark')})
|
.then(function() { return sendCommand('dark')})
|
||||||
.then(function() { return sendCommand('light')})
|
.then(function() { return sendCommand('light')})
|
||||||
.then(assertNoErrors);
|
.then(assertNoErrors);
|
||||||
@@ -62,8 +60,18 @@ describe('launch of application', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should do a shift operation', function() {
|
||||||
|
|
||||||
it('should emphasize bytes', function() {
|
driver.get(appUrl)
|
||||||
|
.then(function() {
|
||||||
|
return assertOperation('1<<1',
|
||||||
|
[{ label: '1', bin:'00000001', other: '0x1'},
|
||||||
|
{ label: '1<<1=2', bin:'00000010', other: '0x2'}])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
xit('should emphasize bytes', function() {
|
||||||
|
|
||||||
driver.get(appUrl)
|
driver.get(appUrl)
|
||||||
.then(function() { return sendCommand('clear')})
|
.then(function() { return sendCommand('clear')})
|
||||||
@@ -95,6 +103,7 @@ function assertNoErrors(cmd) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function assertBitwiseNumbersResults(contaier, array) {
|
function assertBitwiseNumbersResults(contaier, array) {
|
||||||
|
|
||||||
return contaier.findElement(By.css('.expression')).then(function (tableExpr){
|
return contaier.findElement(By.css('.expression')).then(function (tableExpr){
|
||||||
@@ -125,3 +134,13 @@ function assertSingleRowResult(row, label, bin, other) {
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assertOperation(op, expected) {
|
||||||
|
return sendCommand('clear')
|
||||||
|
.then(function() { return sendCommand(op)})
|
||||||
|
.then(assertNoErrors)
|
||||||
|
.then(function() {
|
||||||
|
return assertBitwiseNumbersResults(driver,
|
||||||
|
expected)
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user