You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2017/12/28 00:47:54 UTC

[incubator-plc4x] 16/19: some more tests for coverage

This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 5af2d71b7238f1d66ff8265dce59820fd8367f2d
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Thu Dec 28 09:45:19 2017 +1100

    some more tests for coverage
---
 .../java/s7/netty/model/types/S7TypeTests.java     | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/types/S7TypeTests.java b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/types/S7TypeTests.java
index ee0a6b8..f05df22 100644
--- a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/types/S7TypeTests.java
+++ b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/types/S7TypeTests.java
@@ -37,11 +37,20 @@ class S7TypeTests {
 
     @Test
     @Tag("fast")
+    void unknownDataTransportErrorCode() {
+        DataTransportErrorCode dataTransportErrorCode = DataTransportErrorCode.INVALID_ADDRESS;
+
+        assertTrue(DataTransportErrorCode.valueOf((byte)0xFE) == null, "Unexpected value mapped");
+    }
+
+    @Test
+    @Tag("fast")
     void dataTransportSize() {
         DataTransportSize dataTransportSize = DataTransportSize.DINTEGER;
 
         assertTrue(DataTransportSize.valueOf((byte)6) == DataTransportSize.DINTEGER, "6 incorrectly mapped");
         assertTrue(dataTransportSize.getCode() == (byte)6, "code is not 6");
+        assertTrue(!dataTransportSize.isSizeInBits(), "Unexpected return from bit size");
     }
 
     @Test
@@ -76,6 +85,14 @@ class S7TypeTests {
 
     @Test
     @Tag("fast")
+    void unknownParameterType() {
+        ParameterType parameterType = ParameterType.UPLOAD;
+
+        assertTrue(ParameterType.valueOf((byte)0xFF) == null, "Unexpected value mapped");
+    }
+
+    @Test
+    @Tag("fast")
     void specificationType() {
         SpecificationType specificationType = SpecificationType.VARIABLE_SPECIFICATION;
 
@@ -100,4 +117,21 @@ class S7TypeTests {
         assertTrue(VariableAddressingMode.valueOf((byte)0x19) == VariableAddressingMode.ALARM_ACK, "0x19 incorrectly mapped");
         assertTrue(variableAddressingMode.getCode() == (byte)0x19, "code is not 0x19");
     }
+
+    @Test
+    @Tag("fast")
+    void memoryAccess() {
+        MemoryArea memoryArea = MemoryArea.DATA_BLOCKS;
+
+        assertTrue(memoryArea.valueOf((byte)0x84) == MemoryArea.DATA_BLOCKS, "0x84 incorrectly mapped");
+        assertTrue(memoryArea.getCode() == (byte)0x84, "code is not 0x84");
+    }
+
+    @Test
+    @Tag("fast")
+    void unknownMemoryAccess() {
+        MemoryArea memoryArea = MemoryArea.DATA_BLOCKS;
+
+        assertTrue(memoryArea.valueOf((byte)0xFF) == null, "Unexpected value mapped");
+     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <co...@plc4x.apache.org>.