mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-15 01:12:47 +01:00
Added e2e test cases
This commit is contained in:
@@ -142,12 +142,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.sign}{m.operand1.input}={m.result.input}</td>
|
<td class="label">{m.sign}{m.operand1.input}={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>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ exports.config = {
|
|||||||
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
|
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
|
||||||
|
|
||||||
specs: [
|
specs: [
|
||||||
|
'./e2e/cmdDriver.js',
|
||||||
'./e2e/spec.js'
|
'./e2e/spec.js'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -62,14 +62,40 @@ describe('launch of application', function() {
|
|||||||
|
|
||||||
it('should do a shift operation', function() {
|
it('should do a shift operation', function() {
|
||||||
|
|
||||||
driver.get(appUrl)
|
|
||||||
.then(function() {
|
|
||||||
return assertOperation('1<<1',
|
return assertOperation('1<<1',
|
||||||
[{ label: '1', bin:'00000001', other: '0x1'},
|
[{ label: '1', bin:'00000001', other: '0x1'},
|
||||||
{ label: '1<<1=2', bin:'00000010', other: '0x2'}])
|
{ label: '1<<1=2', bin:'00000010', other: '0x2'}])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should do a ignroe sign RIGHT shift operation', function() {
|
||||||
|
|
||||||
|
return assertOperation('-1>>>1',
|
||||||
|
[{ label: '-1', bin:'11111111111111111111111111111111', other: '-0x1'},
|
||||||
|
{ label: '-1>>>1=2147483647', bin:'01111111111111111111111111111111', other: '0x7fffffff'}])
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should do NOT operation', function() {
|
||||||
|
|
||||||
|
return assertOperation('~1',
|
||||||
|
[{ label: '1', bin:'00000000000000000000000000000001', other: '0x1'},
|
||||||
|
{ label: '~1=-2', bin:'11111111111111111111111111111110', other: '-0x2'}])
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should do OR operation', function() {
|
||||||
|
|
||||||
|
return assertOperation('1|2',
|
||||||
|
[{ label: '1', bin:'00000001', other: '0x1'},
|
||||||
|
{ label: '2', bin:'00000010', other: '0x2'},
|
||||||
|
{ label: '3', bin:'00000011', other: '0x3'}])
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should do prefer hex result', function() {
|
||||||
|
|
||||||
|
return assertOperation('1|0x2',
|
||||||
|
[{ label: '1', bin:'00000001', other: '0x1'},
|
||||||
|
{ label: '0x2', bin:'00000010', other: '2'},
|
||||||
|
{ label: '0x3', bin:'00000011', other: '3'}])
|
||||||
|
});
|
||||||
|
|
||||||
xit('should emphasize bytes', function() {
|
xit('should emphasize bytes', function() {
|
||||||
|
|
||||||
@@ -103,7 +129,6 @@ 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){
|
||||||
@@ -118,10 +143,10 @@ function assertBitwiseNumbersResults(contaier, array) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertSingleRowResult(row, label, bin, other) {
|
function assertSingleRowResult(row, label, bin, other) {
|
||||||
|
|
||||||
return row.findElement(by.css('.label')).then(function (tbLabel) {
|
return row.findElement(by.css('.label')).then(function (tbLabel) {
|
||||||
expect(tbLabel.getText()).toBe(label);
|
expect(tbLabel.getText()).toBe(label);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
@@ -136,11 +161,13 @@ function assertSingleRowResult(row, label, bin, other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function assertOperation(op, expected) {
|
function assertOperation(op, expected) {
|
||||||
|
|
||||||
|
return driver.get(appUrl).then(function() {
|
||||||
return sendCommand('clear')
|
return sendCommand('clear')
|
||||||
.then(function() { return sendCommand(op)})
|
.then(function() { return sendCommand(op)})
|
||||||
.then(assertNoErrors)
|
.then(assertNoErrors)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return assertBitwiseNumbersResults(driver,
|
return assertBitwiseNumbersResults(driver, expected)
|
||||||
expected)
|
|
||||||
});
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user