mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Further implementation
- added new parsing method
This commit is contained in:
@@ -19,7 +19,7 @@ namespace MewtocolTests {
|
||||
|
||||
//corresponds to a R100 boolean register in the PLC
|
||||
//can also be written as R1000 because the last one is a special address
|
||||
[Register(IOType.R, 100, spAdress: 0)]
|
||||
[Register(IOType.R, memoryArea: 85, spAdress: 0)]
|
||||
public bool TestBool1 { get; private set; }
|
||||
|
||||
//corresponds to a XD input of the PLC
|
||||
@@ -60,10 +60,10 @@ namespace MewtocolTests {
|
||||
public BitArray TestBitRegister32 { get; private set; }
|
||||
|
||||
//corresponds to a DT1204 as a 16bit word/int takes the bit at index 9 and writes it back as a boolean
|
||||
[Register(1204, 9, BitCount.B16)]
|
||||
[Register(1204, BitCount.B16, 9)]
|
||||
public bool BitValue { get; private set; }
|
||||
|
||||
[Register(1204, 5, BitCount.B16)]
|
||||
[Register(1204, BitCount.B32, 5)]
|
||||
public bool FillTest { get; private set; }
|
||||
|
||||
//corresponds to a DT7012 - DT7013 as a 32bit time value that gets parsed as a timespan (TIME)
|
||||
@@ -115,7 +115,7 @@ namespace MewtocolTests {
|
||||
var register = interf.GetRegister(nameof(TestRegisterCollection.TestBool1));
|
||||
|
||||
//test generic properties
|
||||
TestBasicGeneration(register, nameof(TestRegisterCollection.TestBool1), false, 100, "R100");
|
||||
TestBasicGeneration(register, nameof(TestRegisterCollection.TestBool1), false, 85, "R85");
|
||||
|
||||
}
|
||||
|
||||
@@ -208,8 +208,8 @@ namespace MewtocolTests {
|
||||
//test generic properties
|
||||
TestBasicGeneration(register, nameof(TestRegisterCollection.TestString2), null!, 7005, "DT7005");
|
||||
|
||||
Assert.Equal(5, ((SRegister)register).ReservedSize);
|
||||
Assert.Equal(4, ((SRegister)register).MemoryLength);
|
||||
Assert.Equal(5, ((BytesRegister<string>)register).ReservedSize);
|
||||
Assert.Equal(4, ((BytesRegister<string>)register).MemoryLength);
|
||||
|
||||
}
|
||||
|
||||
@@ -224,8 +224,8 @@ namespace MewtocolTests {
|
||||
//test generic properties
|
||||
TestBasicGeneration(register, "Auto_Bitwise_DT7010", (short)0, 7010, "DT7010");
|
||||
|
||||
Assert.True(((NRegister<short>)register).isUsedBitwise);
|
||||
Assert.Equal(0, ((NRegister<short>)register).MemoryLength);
|
||||
Assert.True(((NumberRegister<short>)register).isUsedBitwise);
|
||||
Assert.Equal(0, ((NumberRegister<short>)register).MemoryLength);
|
||||
|
||||
}
|
||||
|
||||
@@ -240,8 +240,8 @@ namespace MewtocolTests {
|
||||
//test generic properties
|
||||
TestBasicGeneration(register, "Auto_Bitwise_DDT8010", (int)0, 8010, "DDT8010");
|
||||
|
||||
Assert.True(((NRegister<int>)register).isUsedBitwise);
|
||||
Assert.Equal(1, ((NRegister<int>)register).MemoryLength);
|
||||
Assert.True(((NumberRegister<int>)register).isUsedBitwise);
|
||||
Assert.Equal(1, ((NumberRegister<int>)register).MemoryLength);
|
||||
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace MewtocolTests {
|
||||
//test generic properties
|
||||
TestBasicGeneration(register, "Auto_Bitwise_DT1204", (short)0, 1204, "DT1204");
|
||||
|
||||
Assert.True(((NRegister<short>)register).isUsedBitwise);
|
||||
Assert.True(((NumberRegister<short>)register).isUsedBitwise);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,32 +16,32 @@ public class TestRegisterBuilder {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as BRegister List (Phyiscal Outputs)")]
|
||||
[Fact(DisplayName = "Parsing as Bool Register List (Phyiscal Outputs)")]
|
||||
public void TestParsingBRegisterY() {
|
||||
|
||||
var tests = new Dictionary<string, IRegister>() {
|
||||
|
||||
{"Y0", new BRegister(IOType.Y)},
|
||||
{"Y1", new BRegister(IOType.Y, 0x1)},
|
||||
{"Y2", new BRegister(IOType.Y, 0x2)},
|
||||
{"Y3", new BRegister(IOType.Y, 0x3)},
|
||||
{"Y4", new BRegister(IOType.Y, 0x4)},
|
||||
{"Y5", new BRegister(IOType.Y, 0x5)},
|
||||
{"Y6", new BRegister(IOType.Y, 0x6)},
|
||||
{"Y7", new BRegister(IOType.Y, 0x7)},
|
||||
{"Y8", new BRegister(IOType.Y, 0x8)},
|
||||
{"Y9", new BRegister(IOType.Y, 0x9)},
|
||||
{"Y0", new BoolRegister(IOType.Y)},
|
||||
{"Y1", new BoolRegister(IOType.Y, 0x1)},
|
||||
{"Y2", new BoolRegister(IOType.Y, 0x2)},
|
||||
{"Y3", new BoolRegister(IOType.Y, 0x3)},
|
||||
{"Y4", new BoolRegister(IOType.Y, 0x4)},
|
||||
{"Y5", new BoolRegister(IOType.Y, 0x5)},
|
||||
{"Y6", new BoolRegister(IOType.Y, 0x6)},
|
||||
{"Y7", new BoolRegister(IOType.Y, 0x7)},
|
||||
{"Y8", new BoolRegister(IOType.Y, 0x8)},
|
||||
{"Y9", new BoolRegister(IOType.Y, 0x9)},
|
||||
|
||||
{"YA", new BRegister(IOType.Y, 0xA)},
|
||||
{"YB", new BRegister(IOType.Y, 0xB)},
|
||||
{"YC", new BRegister(IOType.Y, 0xC)},
|
||||
{"YD", new BRegister(IOType.Y, 0xD)},
|
||||
{"YE", new BRegister(IOType.Y, 0xE)},
|
||||
{"YF", new BRegister(IOType.Y, 0xF)},
|
||||
{"YA", new BoolRegister(IOType.Y, 0xA)},
|
||||
{"YB", new BoolRegister(IOType.Y, 0xB)},
|
||||
{"YC", new BoolRegister(IOType.Y, 0xC)},
|
||||
{"YD", new BoolRegister(IOType.Y, 0xD)},
|
||||
{"YE", new BoolRegister(IOType.Y, 0xE)},
|
||||
{"YF", new BoolRegister(IOType.Y, 0xF)},
|
||||
|
||||
{"Y1A", new BRegister(IOType.Y, 0xA, 1)},
|
||||
{"Y10B", new BRegister(IOType.Y, 0xB, 10)},
|
||||
{"Y109C", new BRegister(IOType.Y, 0xC, 109)},
|
||||
{"Y1A", new BoolRegister(IOType.Y, 0xA, 1)},
|
||||
{"Y10B", new BoolRegister(IOType.Y, 0xB, 10)},
|
||||
{"Y109C", new BoolRegister(IOType.Y, 0xC, 109)},
|
||||
|
||||
};
|
||||
|
||||
@@ -49,32 +49,32 @@ public class TestRegisterBuilder {
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as BRegister List (Phyiscal Inputs)")]
|
||||
[Fact(DisplayName = "Parsing as Bool Register List (Phyiscal Inputs)")]
|
||||
public void TestParsingBRegisterX() {
|
||||
|
||||
var tests = new Dictionary<string, IRegister>() {
|
||||
|
||||
{"X0", new BRegister(IOType.X)},
|
||||
{"X1", new BRegister(IOType.X, 0x1)},
|
||||
{"X2", new BRegister(IOType.X, 0x2)},
|
||||
{"X3", new BRegister(IOType.X, 0x3)},
|
||||
{"X4", new BRegister(IOType.X, 0x4)},
|
||||
{"X5", new BRegister(IOType.X, 0x5)},
|
||||
{"X6", new BRegister(IOType.X, 0x6)},
|
||||
{"X7", new BRegister(IOType.X, 0x7)},
|
||||
{"X8", new BRegister(IOType.X, 0x8)},
|
||||
{"X9", new BRegister(IOType.X, 0x9)},
|
||||
{"X0", new BoolRegister(IOType.X)},
|
||||
{"X1", new BoolRegister(IOType.X, 0x1)},
|
||||
{"X2", new BoolRegister(IOType.X, 0x2)},
|
||||
{"X3", new BoolRegister(IOType.X, 0x3)},
|
||||
{"X4", new BoolRegister(IOType.X, 0x4)},
|
||||
{"X5", new BoolRegister(IOType.X, 0x5)},
|
||||
{"X6", new BoolRegister(IOType.X, 0x6)},
|
||||
{"X7", new BoolRegister(IOType.X, 0x7)},
|
||||
{"X8", new BoolRegister(IOType.X, 0x8)},
|
||||
{"X9", new BoolRegister(IOType.X, 0x9)},
|
||||
|
||||
{"XA", new BRegister(IOType.X, 0xA)},
|
||||
{"XB", new BRegister(IOType.X, 0xB)},
|
||||
{"XC", new BRegister(IOType.X, 0xC)},
|
||||
{"XD", new BRegister(IOType.X, 0xD)},
|
||||
{"XE", new BRegister(IOType.X, 0xE)},
|
||||
{"XF", new BRegister(IOType.X, 0xF)},
|
||||
{"XA", new BoolRegister(IOType.X, 0xA)},
|
||||
{"XB", new BoolRegister(IOType.X, 0xB)},
|
||||
{"XC", new BoolRegister(IOType.X, 0xC)},
|
||||
{"XD", new BoolRegister(IOType.X, 0xD)},
|
||||
{"XE", new BoolRegister(IOType.X, 0xE)},
|
||||
{"XF", new BoolRegister(IOType.X, 0xF)},
|
||||
|
||||
{"X1A", new BRegister(IOType.X, 0xA, 1)},
|
||||
{"X10B", new BRegister(IOType.X, 0xB, 10)},
|
||||
{"X109C", new BRegister(IOType.X, 0xC, 109)},
|
||||
{"X1A", new BoolRegister(IOType.X, 0xA, 1)},
|
||||
{"X10B", new BoolRegister(IOType.X, 0xB, 10)},
|
||||
{"X109C", new BoolRegister(IOType.X, 0xC, 109)},
|
||||
|
||||
};
|
||||
|
||||
@@ -82,35 +82,35 @@ public class TestRegisterBuilder {
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as BRegister List (Internal Relay)")]
|
||||
[Fact(DisplayName = "Parsing as Bool Register List (Internal Relay)")]
|
||||
public void TestParsingBRegisterR() {
|
||||
|
||||
var tests = new Dictionary<string, IRegister>() {
|
||||
|
||||
{"R0", new BRegister(IOType.R)},
|
||||
{"R1", new BRegister(IOType.R, 0x1)},
|
||||
{"R2", new BRegister(IOType.R, 0x2)},
|
||||
{"R3", new BRegister(IOType.R, 0x3)},
|
||||
{"R4", new BRegister(IOType.R, 0x4)},
|
||||
{"R5", new BRegister(IOType.R, 0x5)},
|
||||
{"R6", new BRegister(IOType.R, 0x6)},
|
||||
{"R7", new BRegister(IOType.R, 0x7)},
|
||||
{"R8", new BRegister(IOType.R, 0x8)},
|
||||
{"R9", new BRegister(IOType.R, 0x9)},
|
||||
{"R0", new BoolRegister(IOType.R)},
|
||||
{"R1", new BoolRegister(IOType.R, 0x1)},
|
||||
{"R2", new BoolRegister(IOType.R, 0x2)},
|
||||
{"R3", new BoolRegister(IOType.R, 0x3)},
|
||||
{"R4", new BoolRegister(IOType.R, 0x4)},
|
||||
{"R5", new BoolRegister(IOType.R, 0x5)},
|
||||
{"R6", new BoolRegister(IOType.R, 0x6)},
|
||||
{"R7", new BoolRegister(IOType.R, 0x7)},
|
||||
{"R8", new BoolRegister(IOType.R, 0x8)},
|
||||
{"R9", new BoolRegister(IOType.R, 0x9)},
|
||||
|
||||
{"RA", new BRegister(IOType.R, 0xA)},
|
||||
{"RB", new BRegister(IOType.R, 0xB)},
|
||||
{"RC", new BRegister(IOType.R, 0xC)},
|
||||
{"RD", new BRegister(IOType.R, 0xD)},
|
||||
{"RE", new BRegister(IOType.R, 0xE)},
|
||||
{"RF", new BRegister(IOType.R, 0xF)},
|
||||
{"RA", new BoolRegister(IOType.R, 0xA)},
|
||||
{"RB", new BoolRegister(IOType.R, 0xB)},
|
||||
{"RC", new BoolRegister(IOType.R, 0xC)},
|
||||
{"RD", new BoolRegister(IOType.R, 0xD)},
|
||||
{"RE", new BoolRegister(IOType.R, 0xE)},
|
||||
{"RF", new BoolRegister(IOType.R, 0xF)},
|
||||
|
||||
{"R1A", new BRegister(IOType.R, 0xA, 1)},
|
||||
{"R10B", new BRegister(IOType.R, 0xB, 10)},
|
||||
{"R109C", new BRegister(IOType.R, 0xC, 109)},
|
||||
{"R1000", new BRegister(IOType.R, 0x0, 100)},
|
||||
{"R511", new BRegister(IOType.R, 0x0, 511)},
|
||||
{"R511A", new BRegister(IOType.R, 0xA, 511)},
|
||||
{"R1A", new BoolRegister(IOType.R, 0xA, 1)},
|
||||
{"R10B", new BoolRegister(IOType.R, 0xB, 10)},
|
||||
{"R109C", new BoolRegister(IOType.R, 0xC, 109)},
|
||||
{"R1000", new BoolRegister(IOType.R, 0x0, 100)},
|
||||
{"R511", new BoolRegister(IOType.R, 0x0, 511)},
|
||||
{"R511A", new BoolRegister(IOType.R, 0xA, 511)},
|
||||
|
||||
};
|
||||
|
||||
@@ -126,7 +126,7 @@ public class TestRegisterBuilder {
|
||||
|
||||
output.WriteLine($"Expected: {item.Key}");
|
||||
|
||||
var built = RegBuilder.FromPlcRegName(item.Key).AsPlcType(PlcVarType.BOOL).Build();
|
||||
var built = RegBuilder.Factory.FromPlcRegName(item.Key).AsPlcType(PlcVarType.BOOL).Build();
|
||||
|
||||
output.WriteLine($"{(built?.ToString(true) ?? "null")}\n");
|
||||
Assert.Equivalent(item.Value, built);
|
||||
@@ -141,63 +141,75 @@ public class TestRegisterBuilder {
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as BRegister (Casted)")]
|
||||
[Fact(DisplayName = "Parsing as Bool Register (Casted)")]
|
||||
public void TestRegisterBuildingBoolCasted () {
|
||||
|
||||
var expect = new BRegister(IOType.R, 0x1, 0);
|
||||
var expect2 = new BRegister(IOType.Y, 0xA, 103);
|
||||
var expect = new BoolRegister(IOType.R, 0x1, 0);
|
||||
var expect2 = new BoolRegister(IOType.Y, 0xA, 103);
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("R1").AsPlcType(PlcVarType.BOOL).Build());
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("R1").AsType<bool>().Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("R1").AsPlcType(PlcVarType.BOOL).Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("R1").AsType<bool>().Build());
|
||||
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("Y103A").AsPlcType(PlcVarType.BOOL).Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("Y103A").AsType<bool>().Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("Y103A").AsPlcType(PlcVarType.BOOL).Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("Y103A").AsType<bool>().Build());
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as BRegister (Auto)")]
|
||||
[Fact(DisplayName = "Parsing as Bool Register (Auto)")]
|
||||
public void TestRegisterBuildingBoolAuto () {
|
||||
|
||||
var expect = new BRegister(IOType.R, 0x1, 0);
|
||||
var expect2 = new BRegister(IOType.Y, 0xA, 103);
|
||||
var expect = new BoolRegister(IOType.R, 0x1, 0);
|
||||
var expect2 = new BoolRegister(IOType.Y, 0xA, 103);
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("R1").Build());
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("R1").Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("R1").Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("R1").Build());
|
||||
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("Y103A").Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("Y103A").Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("Y103A").Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("Y103A").Build());
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as NRegister (Casted)")]
|
||||
[Fact(DisplayName = "Parsing as Number Register (Casted)")]
|
||||
public void TestRegisterBuildingNumericCasted() {
|
||||
|
||||
var expect = new NRegister<short>(303, null);
|
||||
var expect2 = new NRegister<int>(10002, null);
|
||||
var expect3 = new NRegister<TimeSpan>(400, null);
|
||||
var expect = new NumberRegister<short>(303, null);
|
||||
var expect2 = new NumberRegister<int>(10002, null);
|
||||
var expect3 = new NumberRegister<TimeSpan>(400, null);
|
||||
//var expect4 = new NRegister<TimeSpan>(103, null, true);
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("DT303").AsPlcType(PlcVarType.INT).Build());
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("DT303").AsType<short>().Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("DT303").AsPlcType(PlcVarType.INT).Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("DT303").AsType<short>().Build());
|
||||
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("DDT10002").AsPlcType(PlcVarType.DINT).Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("DDT10002").AsType<int>().Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("DDT10002").AsPlcType(PlcVarType.DINT).Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("DDT10002").AsType<int>().Build());
|
||||
|
||||
Assert.Equivalent(expect3, RegBuilder.FromPlcRegName("DDT400").AsPlcType(PlcVarType.TIME).Build());
|
||||
Assert.Equivalent(expect3, RegBuilder.FromPlcRegName("DDT400").AsType<TimeSpan>().Build());
|
||||
Assert.Equivalent(expect3, RegBuilder.Factory.FromPlcRegName("DDT400").AsPlcType(PlcVarType.TIME).Build());
|
||||
Assert.Equivalent(expect3, RegBuilder.Factory.FromPlcRegName("DDT400").AsType<TimeSpan>().Build());
|
||||
|
||||
//Assert.Equivalent(expect4, RegBuilder.FromPlcRegName("DT103").AsType<BitArray>().Build());
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as NRegister (Auto)")]
|
||||
[Fact(DisplayName = "Parsing as Number Register (Auto)")]
|
||||
public void TestRegisterBuildingNumericAuto() {
|
||||
|
||||
var expect = new NRegister<short>(303, null);
|
||||
var expect2 = new NRegister<int>(10002, null);
|
||||
var expect = new NumberRegister<short>(303, null);
|
||||
var expect2 = new NumberRegister<int>(10002, null);
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("DT303").Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.Factory.FromPlcRegName("DDT10002").Build());
|
||||
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Parsing as Bytes Register (Casted)")]
|
||||
public void TestRegisterBuildingByteRangeCasted() {
|
||||
|
||||
var expect = new BytesRegister<byte[]>(303, 5);
|
||||
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("DT303").AsPlcType(PlcVarType.INT).Build());
|
||||
Assert.Equivalent(expect, RegBuilder.Factory.FromPlcRegName("DT303").AsType<short>().Build());
|
||||
|
||||
Assert.Equivalent(expect, RegBuilder.FromPlcRegName("DT303").Build());
|
||||
Assert.Equivalent(expect2, RegBuilder.FromPlcRegName("DDT10002").Build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace MewtocolTests {
|
||||
public void NumericRegisterMewtocolIdentifiers() {
|
||||
|
||||
List<IRegister> registers = new List<IRegister> {
|
||||
new NRegister<short>(50, _name: null),
|
||||
new NRegister<ushort>(50, _name: null),
|
||||
new NRegister<int>(50, _name : null),
|
||||
new NRegister<uint>(50, _name : null),
|
||||
new NRegister<float>(50, _name : null),
|
||||
new NRegister<TimeSpan>(50, _name : null),
|
||||
new NumberRegister<short>(50, _name: null),
|
||||
new NumberRegister<ushort>(50, _name: null),
|
||||
new NumberRegister<int>(50, _name : null),
|
||||
new NumberRegister<uint>(50, _name : null),
|
||||
new NumberRegister<float>(50, _name : null),
|
||||
new NumberRegister<TimeSpan>(50, _name : null),
|
||||
};
|
||||
|
||||
List<string> expectedIdents = new List<string> {
|
||||
@@ -51,23 +51,23 @@ namespace MewtocolTests {
|
||||
|
||||
List<IRegister> registers = new List<IRegister> {
|
||||
//numeric ones
|
||||
new NRegister<short>(50, _name: null),
|
||||
new NRegister<ushort>(60, _name : null),
|
||||
new NRegister<int>(70, _name : null),
|
||||
new NRegister<uint>(80, _name : null),
|
||||
new NRegister<float>(90, _name : null),
|
||||
new NRegister<TimeSpan>(100, _name : null),
|
||||
new NumberRegister<short>(50, _name: null),
|
||||
new NumberRegister<ushort>(60, _name : null),
|
||||
new NumberRegister<int>(70, _name : null),
|
||||
new NumberRegister<uint>(80, _name : null),
|
||||
new NumberRegister<float>(90, _name : null),
|
||||
new NumberRegister<TimeSpan>(100, _name : null),
|
||||
|
||||
//boolean
|
||||
new BRegister(IOType.R, 0, 100),
|
||||
new BRegister(IOType.R, 0, 0),
|
||||
new BRegister(IOType.X, 5),
|
||||
new BRegister(IOType.X, 0xA),
|
||||
new BRegister(IOType.X, 0xF, 109),
|
||||
new BRegister(IOType.Y, 0xC, 75),
|
||||
new BoolRegister(IOType.R, 0, 100),
|
||||
new BoolRegister(IOType.R, 0, 0),
|
||||
new BoolRegister(IOType.X, 5),
|
||||
new BoolRegister(IOType.X, 0xA),
|
||||
new BoolRegister(IOType.X, 0xF, 109),
|
||||
new BoolRegister(IOType.Y, 0xC, 75),
|
||||
|
||||
//string
|
||||
new SRegister(999, 5),
|
||||
new BytesRegister<string>(999, 5),
|
||||
};
|
||||
|
||||
List<string> expcectedIdents = new List<string> {
|
||||
@@ -110,7 +110,7 @@ namespace MewtocolTests {
|
||||
|
||||
var ex = Assert.Throws<NotSupportedException>(() => {
|
||||
|
||||
new NRegister<short>(100000, _name: null);
|
||||
new NumberRegister<short>(100000, _name: null);
|
||||
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace MewtocolTests {
|
||||
|
||||
var ex1 = Assert.Throws<NotSupportedException>(() => {
|
||||
|
||||
new BRegister(IOType.R, _areaAdress: 512);
|
||||
new BoolRegister(IOType.R, _areaAdress: 512);
|
||||
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace MewtocolTests {
|
||||
|
||||
var ex2 = Assert.Throws<NotSupportedException>(() => {
|
||||
|
||||
new BRegister(IOType.X, _areaAdress: 110);
|
||||
new BoolRegister(IOType.X, _areaAdress: 110);
|
||||
|
||||
});
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace MewtocolTests {
|
||||
|
||||
var ex3 = Assert.Throws<NotSupportedException>(() => {
|
||||
|
||||
new SRegister(100000, 5);
|
||||
new BytesRegister<string>(100000, 5);
|
||||
|
||||
});
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace MewtocolTests {
|
||||
|
||||
var ex = Assert.Throws<NotSupportedException>(() => {
|
||||
|
||||
new NRegister<double>(100, _name: null);
|
||||
new NumberRegister<double>(100, _name: null);
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user