Fixed bug in shift operation

This commit is contained in:
Borys Levytskyi
2015-04-12 14:56:33 +03:00
parent bd719b0ef6
commit 74c7183a87
2 changed files with 24 additions and 5 deletions

View File

@@ -127,12 +127,12 @@
<table class="expression">
<tr>
<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>
</tr>
<tr class="result">
<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>
</tr>
</table>

View File

@@ -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 ^ 123')})
.then(function() { return sendCommand('em')})
.then(function() { return sendCommand('em')})
.then(function() { return sendCommand('dark')})
.then(function() { return sendCommand('light')})
.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)
.then(function() { return sendCommand('clear')})
@@ -95,6 +103,7 @@ function assertNoErrors(cmd) {
});
}
function assertBitwiseNumbersResults(contaier, array) {
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)
});
}