-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [#145] Moved OutputStreamOutStream to testing package * [#145] Added IostreamChannel * [#145] Renamed RawConnection->DirectConnection, IostreamChannel->LocalChannel * [#145] Moved old accept tests and updated test dep versions / added BOMs * [#145] Improved docs * [#145] ByteString.toString more readable * [#145] Moved testing components to src/test and added test deps * [#145] Added reset to ByteStringBuilder * [#145] Added indexOf, count, substring to ByteString * [#145] Ensure logging works correctly in tests * [#145] Improve logging across Z-Expressions * [#145] ByteString.from() -> byteString(), to improve static imports * [#145] First working Cucumber test, with LocalConnection and LocalChannel * [#145] Fix test * [#145] Improved logging * [#145] Better buffer tokenization tools and exceptions * [#145] Device acceptance tests * [#145] Better debugging * [#145] Full local device test capability * [#145] ZscriptExpression.fields(), and field matching for tests * [#145] Acceptance steps and general logic and device tests * [#145] Extended tests for parsing and response matching * [#145] Added more cucumber tests, and deleted experimental code * [#145] Added more cucumber tests * [#145] Added more cucumber tests * [#145] Fixed LocalChannel test * [#145] Fixed GCC (after upgrade to v13) * [#145] Added more cucumber tests
- Loading branch information
Showing
148 changed files
with
4,018 additions
and
765 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>net.zscript</groupId> | ||
<artifactId>zscript-all</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>acceptance-tests-old</artifactId> | ||
<name>Zscript Acceptance Tests (OLD)</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<!-- Note: test dependencies are scoped here as "compile" because this is a test project --> | ||
<groupId>net.zscript</groupId> | ||
<artifactId>java-testing-deps</artifactId> | ||
<version>${project.version}</version> | ||
<scope>compile</scope> | ||
<type>pom</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.cucumber</groupId> | ||
<artifactId>cucumber-junit</artifactId> | ||
</dependency> | ||
<!-- <dependency>--> | ||
<!-- <groupId>org.junit.vintage</groupId>--> | ||
<!-- <artifactId>junit-vintage-engine</artifactId>--> | ||
<!-- </dependency>--> | ||
</dependencies> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
51 changes: 51 additions & 0 deletions
51
acceptance-tests/src/main/java/net/zscript/acceptance/BasicSequenceSteps.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package net.zscript.acceptance; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import static net.zscript.util.ByteString.byteString; | ||
import static net.zscript.util.ByteString.byteStringUtf8; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import net.zscript.javaclient.commandPaths.CommandExecutionPath; | ||
import net.zscript.javaclient.commandPaths.ResponseExecutionPath; | ||
import net.zscript.javaclient.sequence.ResponseSequence; | ||
import net.zscript.javaclient.tokens.ExtendingTokenBuffer; | ||
|
||
public class BasicSequenceSteps { | ||
private static final Logger LOG = LoggerFactory.getLogger(BasicSequenceSteps.class); | ||
|
||
private final DeviceSteps deviceSteps; | ||
private ResponseExecutionPath actualExecutionPath; | ||
|
||
public BasicSequenceSteps(DeviceSteps deviceSteps) { | ||
this.deviceSteps = deviceSteps; | ||
} | ||
|
||
@When("the command sequence {string} is sent to the target") | ||
public void sendCommandSequence(String commandSequenceAsText) { | ||
final AtomicReference<ResponseExecutionPath> response = new AtomicReference<>(); | ||
|
||
final ExtendingTokenBuffer buffer = ExtendingTokenBuffer.tokenize(byteStringUtf8(commandSequenceAsText), true); | ||
final CommandExecutionPath commandPath = CommandExecutionPath.parse(deviceSteps.getModel(), buffer.getTokenReader().getFirstReadToken()); | ||
|
||
deviceSteps.getTestDeviceHandle().send(commandPath, response::set); | ||
|
||
deviceSteps.progressDeviceWhile(t -> response.get() == null); | ||
|
||
actualExecutionPath = response.get(); | ||
} | ||
|
||
@Then("the response sequence should match {string}") | ||
public void responseSequenceShouldMatch(String responseSequenceAsText) { | ||
final ExtendingTokenBuffer buffer = ExtendingTokenBuffer.tokenize(byteStringUtf8(responseSequenceAsText)); | ||
final ResponseSequence expectedResponseSeq = ResponseSequence.parse(buffer.getTokenReader().getFirstReadToken()); | ||
|
||
LOG.trace("sequence match: [actualExecutionPath={}, expectedResponseSeq = {}", actualExecutionPath, expectedResponseSeq); | ||
assertThat(byteString(actualExecutionPath)).isEqualTo(byteString(expectedResponseSeq.getExecutionPath())); | ||
} | ||
} |
Oops, something went wrong.