This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Client::ProcessRequest(void) | |
{ | |
QByteArray request = tcpSocket->readAll(); | |
QScriptEngine engine; | |
// Validate that the request was parsed and non-empty | |
QScriptValue data = engine.evaluate("(" + QString(request) + ")"); | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QString Client::ProcessCommand(QScriptValue req) | |
{ | |
QScriptValue cmd = req.property("command"); | |
QString response; | |
// Basic sanity check | |
if (!cmd.isValid()) | |
{ | |
response = CommandErrorResponse("invalid", "No command specified"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcpSocket = new QTcpSocket(this); | |
... | |
Q_ASSERT(connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(ProcessRequest()))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def initialize | |
@server = TCPServer.new 19024 | |
end | |
def start | |
@server_thread = Thread.new do | |
@client_thread = Thread.start(@server.accept) do |client| | |
puts "server: Accepted client connection!" | |
send_request(client, 'greeting', :message => 'Hello client!') | |
receive_response(client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QString Client::ProcessCommand(QScriptValue req) | |
{ | |
QScriptValue cmd = req.property("command"); | |
QString response; | |
// Basic sanity check | |
if (!cmd.isValid()) | |
{ | |
response = CommandErrorResponse("invalid", "No command specified"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gtest/gtest.h> | |
#include <cucumber-cpp/defs.hpp> | |
#include <Calculator.h> | |
struct CalcCtx { | |
Calculator calc; | |
double result; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: Regular numbers # division.feature:6 | |
> ["begin_scenario"] # Cucumber sends this message to the Wire server to start the scenario | |
< ["success"] # Each message sent to the Wire server is acknowledged, and may include response data as well | |
> ["step_matches", # Cucumber sends the first step of the scenario | |
{ | |
"name_to_match":"I have entered 3 into the calculator" | |
} | |
] | |
< ["success", # The Wire server responds with the regular expression that matches the specified step, including the extracted parameter and location of the step definition | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Division | |
In order to avoid silly mistakes | |
Cashiers must be able to calculate a fraction | |
Scenario: Regular numbers | |
Given I have entered 3 into the calculator | |
And I have entered 2 into the calculator | |
When I press divide | |
Then the result should be 1.5 on the screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Division | |
In order to avoid silly mistakes | |
Cashiers must be able to calculate a fraction | |
Scenario: Regular numbers # division.feature:6 | |
Given I have entered 3 into the calculator # CalculatorSteps.cpp:11 | |
And I have entered 2 into the calculator # CalculatorSteps.cpp:11 | |
When I press divide # CalculatorSteps.cpp:22 | |
Then the result should be 1.5 on the screen # CalculatorSteps.cpp:27 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Division | |
In order to avoid silly mistakes | |
Cashiers must be able to calculate a fraction | |
Scenario: Regular numbers # examples/Calc/CalcFeatures/features/division.feature:6 | |
> ["begin_scenario"] | |
< ["success"] | |
> ["step_matches",{"name_to_match":"I have entered 3 into the calculator"}] | |
< ["success",[{"regexp":"^I have entered (\\d+) into the calculator$","args":[{"val":"3","pos":15}],"id":"1","source":"GTestCalculatorSteps.cpp:11"}]] | |
> ["invoke",{"args":["3"],"id":"1"}] |