From 1164ecdb660fbeacebd78a586eb1549875f4f96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Fri, 16 Aug 2024 15:43:41 +0200 Subject: [PATCH] feat(plc4go/bacnet): add primitive data boolean --- plc4go/internal/bacnetip/comp.go | 2 + plc4go/internal/bacnetip/primitivedata.go | 227 ++++++++++++++++-- .../test_iocb/test_clientcontroller_test.go | 22 ++ .../tests/test_iocb/test_iocb_test.go | 22 ++ .../tests/test_iocb/test_iochain_test.go | 22 ++ .../tests/test_iocb/test_iocontroller_test.go | 22 ++ .../tests/test_iocb/test_iogroup_test.go | 22 ++ .../test_iocb/test_ioqcontroller_test.go | 22 ++ .../tests/test_iocb/test_ioqueue_test.go | 22 ++ .../test_sieveclientcontroller_test.go | 22 ++ .../test_local/test_local_schedule_1_test.go | 22 ++ .../test_local/test_local_schedule_2_test.go | 22 ++ .../bacnetip/tests/test_network/helpers.go | 22 ++ .../tests/test_network/test_net_1_test.go | 22 ++ .../tests/test_network/test_net_2_test.go | 22 ++ .../tests/test_network/test_net_3_test.go | 22 ++ .../tests/test_network/test_net_4_test.go | 22 ++ .../tests/test_network/test_net_5_test.go | 22 ++ .../tests/test_network/test_net_6_test.go | 22 ++ .../tests/test_network/test_net_7_test.go | 22 ++ .../bacnetip/tests/test_npdu/helpers.go | 20 ++ .../tests/test_npdu/test_codec_test.go | 22 ++ .../tests/test_primitive_data/common_test.go | 38 +++ .../test_bit_string_test.go | 24 +- .../test_primitive_data/test_boolean_test.go | 133 ++++++++++ .../test_character_string_test.go | 22 ++ .../test_primitive_data/test_date_test.go | 22 ++ .../test_primitive_data/test_double_test.go | 22 ++ .../test_enumerated_test.go | 22 ++ .../test_primitive_data/test_integer_test.go | 22 ++ .../test_primitive_data/test_null_test.go | 22 ++ .../test_object_identifier_test.go | 22 ++ .../test_object_type_test.go | 22 ++ .../test_octet_string_test.go | 22 ++ .../test_primitive_data/test_real_test.go | 22 ++ .../test_primitive_data/test_tag_test.go | 22 ++ .../test_primitive_data/test_time_test.go | 22 ++ .../test_primitive_data/test_unsigned_test.go | 22 ++ .../tests/test_segmentation/test_1_test.go | 2 +- 39 files changed, 1110 insertions(+), 40 deletions(-) create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_clientcontroller_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_iocb_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_iochain_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_iocontroller_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_iogroup_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_ioqcontroller_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_ioqueue_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_iocb/test_sieveclientcontroller_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_local/test_local_schedule_1_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_local/test_local_schedule_2_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/helpers.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_1_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_2_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_3_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_4_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_5_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_6_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_network/test_net_7_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_npdu/helpers.go create mode 100644 plc4go/internal/bacnetip/tests/test_npdu/test_codec_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/common_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_boolean_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_character_string_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_date_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_double_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_enumerated_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_integer_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_null_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_object_identifier_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_object_type_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_octet_string_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_real_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_tag_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_time_test.go create mode 100644 plc4go/internal/bacnetip/tests/test_primitive_data/test_unsigned_test.go diff --git a/plc4go/internal/bacnetip/comp.go b/plc4go/internal/bacnetip/comp.go index 1e1dfe3fbd9..099b9a5197b 100644 --- a/plc4go/internal/bacnetip/comp.go +++ b/plc4go/internal/bacnetip/comp.go @@ -21,6 +21,8 @@ package bacnetip import "fmt" +type Arg any + type Args []any var NoArgs = NewArgs() diff --git a/plc4go/internal/bacnetip/primitivedata.go b/plc4go/internal/bacnetip/primitivedata.go index bcccc18f095..3d76709a0c4 100644 --- a/plc4go/internal/bacnetip/primitivedata.go +++ b/plc4go/internal/bacnetip/primitivedata.go @@ -21,10 +21,13 @@ package bacnetip import ( "bytes" + "cmp" "fmt" + "strings" + "github.com/apache/plc4x/plc4go/protocols/bacnetip/readwrite/model" + "github.com/pkg/errors" - "strings" ) const ( @@ -36,34 +39,34 @@ const ( TagClosingTagClass = 3 // Deprecated: use model.BACnetDataType_NULL - Tag_nullAppTag = model.BACnetDataType_NULL + TagNullAppTag = model.BACnetDataType_NULL // Deprecated: use model.BACnetDataType_BOOLEAN - Tag_booleanAppTag = model.BACnetDataType_BOOLEAN + TagBooleanAppTag = model.BACnetDataType_BOOLEAN // Deprecated: use model.BACnetDataType_UNSIGNED_INTEGER - Tag_unsignedAppTag = model.BACnetDataType_UNSIGNED_INTEGER + TagUnsignedAppTag = model.BACnetDataType_UNSIGNED_INTEGER // Deprecated: use model.BACnetDataType_SIGNED_INTEGER - Tag_integerAppTag = model.BACnetDataType_SIGNED_INTEGER + TagIntegerAppTag = model.BACnetDataType_SIGNED_INTEGER // Deprecated: use model.BACnetDataType_REAL - Tag_realAppTag = model.BACnetDataType_REAL + TagRealAppTag = model.BACnetDataType_REAL // Deprecated: use model.BACnetDataType_DOUBLE - Tag_doubleAppTag = model.BACnetDataType_DOUBLE + TagDoubleAppTag = model.BACnetDataType_DOUBLE // Deprecated: use model.BACnetDataType_OCTET_STRING - Tag_octetStringAppTag = model.BACnetDataType_OCTET_STRING + TagOctetStringAppTag = model.BACnetDataType_OCTET_STRING // Deprecated: use model.BACnetDataType_CHARACTER_STRING - Tag_characterStringAppTag = model.BACnetDataType_CHARACTER_STRING + TagCharacterStringAppTag = model.BACnetDataType_CHARACTER_STRING // Deprecated: use model.BACnetDataType_BIT_STRING - Tag_bitStringAppTag = model.BACnetDataType_BIT_STRING + TagBitStringAppTag = model.BACnetDataType_BIT_STRING // Deprecated: use model.BACnetDataType_ENUMERATED - Tag_enumeratedAppTag = model.BACnetDataType_ENUMERATED + TagEnumeratedAppTag = model.BACnetDataType_ENUMERATED // Deprecated: use model.BACnetDataType_DATE - Tag_dateAppTag = model.BACnetDataType_DATE + TagDateAppTag = model.BACnetDataType_DATE // Deprecated: use model.BACnetDataType_TIME - Tag_timeAppTag = model.BACnetDataType_TIME + TagTimeAppTag = model.BACnetDataType_TIME // Deprecated: use model.BACnetDataType_BACNET_OBJECT_IDENTIFIER - Tag_objectIdentifierAppTag = model.BACnetDataType_BACNET_OBJECT_IDENTIFIER - Tag_reservedAppTag13 = 13 - Tag_reservedAppTag14 = 14 - Tag_reservedAppTag15 = 15 + TagObjectIdentifierAppTag = model.BACnetDataType_BACNET_OBJECT_IDENTIFIER + TagReservedAppTag13 = 13 + TagReservedAppTag14 = 14 + TagReservedAppTag15 = 15 ) type Tag struct { @@ -93,12 +96,25 @@ func (t *Tag) decode(arg any) { } func (t *Tag) set(args Args) { - t.tagClass = args[0].(model.TagClass) + switch arg0 := args[0].(type) { + case model.TagClass: + t.tagClass = arg0 + case uint: + t.tagClass = model.TagClass(arg0) + case int: + t.tagClass = model.TagClass(arg0) + default: + panic("oh no") + } switch arg1 := args[1].(type) { case model.BACnetDataType: t.tagNumber = uint(arg1) case uint: t.tagNumber = arg1 + case int: + t.tagNumber = uint(arg1) + default: + panic("oh no") } if len(args) == 2 { return @@ -148,10 +164,181 @@ func (t *Tag) Equals(other any) bool { type ApplicationTag struct { model.BACnetApplicationTag + // TODO: implement me } type ContextTag struct { model.BACnetContextTag + // TODO: implement me +} + +type OpeningTag struct { + // TODO: implement me +} + +type ClosingTag struct { + // TODO: implement me +} + +type TagList struct { + // TODO: implement me +} + +type ComparableAndOrdered interface { + comparable + cmp.Ordered +} + +// AtomicContract provides a set of functions which can be overwritten by a sub struct +type AtomicContract[T ComparableAndOrdered] interface { + Compare(other any) int + LowerThan(other any) bool + Equals(other any) bool + GetValue() T +} + +// AtomicRequirements provides a set of functions which must be overwritten by a sub struct +type AtomicRequirements interface { + IsValid(arg any) bool +} + +// Atomic is an abstract struct +type Atomic[T ComparableAndOrdered] struct { + AtomicContract[T] + atomicRequirements AtomicRequirements + + value T +} + +func NewAtomic[T ComparableAndOrdered](subStruct interface { + AtomicContract[T] + AtomicRequirements +}) *Atomic[T] { + return &Atomic[T]{ + AtomicContract: subStruct, + atomicRequirements: subStruct, + } +} + +func (a *Atomic[T]) Compare(other any) int { + otherValue := other.(AtomicContract[T]).GetValue() + // now compare the values + if a.value < otherValue { + return -1 + } else if a.value > otherValue { + return 1 + } else { + return 0 + } +} + +func (a *Atomic[T]) LowerThan(other any) bool { + otherValue := other.(AtomicContract[T]).GetValue() + // now compare the values + return a.value < otherValue +} + +func (a *Atomic[T]) Equals(other any) bool { + otherValue := other.(AtomicContract[T]).GetValue() + // now compare the values + return a.value == otherValue +} + +func (a *Atomic[T]) GetValue() T { + return a.value +} + +func (a *Atomic[T]) Coerce(arg any) T { + return arg.(AtomicContract[T]).GetValue() +} + +type CommonMath struct { + // TODO: implement me +} + +type Null struct { + // TODO: implement me +} + +type Boolean struct { + *Atomic[int] //Note we need int as bool can't be used +} + +func NewBoolean(arg Arg) (*Boolean, error) { + b := &Boolean{} + b.Atomic = NewAtomic[int](b) + b.value = 0 // atomic doesn't like bool + + if arg == nil { + return b, nil + } + switch arg := arg.(type) { + case *Tag: + err := b.Decode(arg) + if err != nil { + return nil, errors.Wrap(err, "error decoding") + } + return b, nil + case bool: + if arg { + b.value = 1 + } + case *Boolean: + b.value = arg.value + case string: + switch arg { + case "True", "true": + b.value = 1 + case "False", "false": + default: + return nil, errors.Errorf("invalid string: %s", arg) + } + default: + return nil, errors.Errorf("invalid constructor datatype: %T", arg) + } + + return b, nil +} + +func (b *Boolean) Encode(tag *Tag) { + tag.set(NewArgs(model.TagClass_APPLICATION_TAGS, model.BACnetDataType_BOOLEAN, b.value, []byte{})) +} + +func (b *Boolean) Decode(tag *Tag) error { + if tag.tagClass != model.TagClass_APPLICATION_TAGS || tag.tagNumber != uint(model.BACnetDataType_BOOLEAN) { + return errors.New("boolean application tag required") + } + if tag.tagLVT > 1 { + return errors.New("invalid tag value") + } + + // get the data + if tag.tagLVT == 1 { + b.value = 1 + } + return nil +} + +func (b *Boolean) IsValid(arg any) bool { + _, ok := arg.(bool) + return ok +} + +// GetValue gives an int value because bool can't be used in constraint. A convenience method GetBoolValue exists. +func (b *Boolean) GetValue() int { + return b.Atomic.GetValue() +} + +func (b *Boolean) GetBoolValue() bool { + return b.GetValue() == 1 +} + +func (b *Boolean) String() string { + value := "False" + if b.value == 1 { + value = "True" + } + return fmt.Sprintf("Boolean(%s)", value) } // BitStringExtension can be used to inherit from BitString @@ -162,6 +349,8 @@ type BitStringExtension interface { } type BitString struct { + *Atomic[int] // TODO: implement properly + bitStringExtension BitStringExtension Value []bool } @@ -217,7 +406,7 @@ func NewBitStringWithExtension(bitStringExtension BitStringExtension, arg ...any } func (b *BitString) Decode(tag *Tag) error { - if tag.GetTagClass() != model.TagClass_APPLICATION_TAGS || tag.GetTagNumber() != uint(Tag_bitStringAppTag) { + if tag.GetTagClass() != model.TagClass_APPLICATION_TAGS || tag.GetTagNumber() != uint(TagBitStringAppTag) { return errors.New("bit string application tag required") } if len(tag.GetTagData()) == 0 { diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_clientcontroller_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_clientcontroller_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_clientcontroller_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_iocb_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_iocb_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_iocb_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_iochain_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_iochain_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_iochain_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_iocontroller_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_iocontroller_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_iocontroller_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_iogroup_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_iogroup_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_iogroup_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_ioqcontroller_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_ioqcontroller_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_ioqcontroller_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_ioqueue_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_ioqueue_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_ioqueue_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_iocb/test_sieveclientcontroller_test.go b/plc4go/internal/bacnetip/tests/test_iocb/test_sieveclientcontroller_test.go new file mode 100644 index 00000000000..5e872352d2c --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_iocb/test_sieveclientcontroller_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_iocb + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_1_test.go b/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_1_test.go new file mode 100644 index 00000000000..1f6403fdf27 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_1_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_local + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_2_test.go b/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_2_test.go new file mode 100644 index 00000000000..1f6403fdf27 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_local/test_local_schedule_2_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_local + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/helpers.go b/plc4go/internal/bacnetip/tests/test_network/helpers.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/helpers.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_1_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_1_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_1_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_2_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_2_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_2_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_3_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_3_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_3_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_4_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_4_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_4_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_5_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_5_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_5_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_6_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_6_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_6_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_network/test_net_7_test.go b/plc4go/internal/bacnetip/tests/test_network/test_net_7_test.go new file mode 100644 index 00000000000..d4a04975223 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_network/test_net_7_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_network + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_npdu/helpers.go b/plc4go/internal/bacnetip/tests/test_npdu/helpers.go new file mode 100644 index 00000000000..6a6142cc90e --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_npdu/helpers.go @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_npdu diff --git a/plc4go/internal/bacnetip/tests/test_npdu/test_codec_test.go b/plc4go/internal/bacnetip/tests/test_npdu/test_codec_test.go new file mode 100644 index 00000000000..d63467626df --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_npdu/test_codec_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_npdu + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/common_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/common_test.go new file mode 100644 index 00000000000..647cc614f87 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/common_test.go @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +import "github.com/apache/plc4x/plc4go/internal/bacnetip" + +func Tag(args ...any) *bacnetip.Tag { + tag, err := bacnetip.NewTag(args) + if err != nil { + panic(err) + } + return tag +} + +func xtob(hexString string) []byte { + bytes, err := bacnetip.Xtob(hexString) + if err != nil { + panic(err) + } + return bytes +} diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_bit_string_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_bit_string_test.go index cef1d16bd88..012fe2cb2a3 100644 --- a/plc4go/internal/bacnetip/tests/test_primitive_data/test_bit_string_test.go +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_bit_string_test.go @@ -75,28 +75,12 @@ func (s *sampleBitString) String() string { return s.BitString.String() } -func Tag(args ...any) *bacnetip.Tag { - tag, err := bacnetip.NewTag(args) - if err != nil { - panic(err) - } - return tag -} - -func xtob(hexString string) []byte { - bytes, err := bacnetip.Xtob(hexString) - if err != nil { - panic(err) - } - return bytes -} - // Convert a hex string to a bit_string application tag. func bitStringTag(t *testing.T, x string) *bacnetip.Tag { t.Helper() b, err := bacnetip.Xtob(x) require.NoError(t, err) - tag, err := bacnetip.NewTag(bacnetip.NewArgs(model.TagClass_APPLICATION_TAGS, bacnetip.Tag_bitStringAppTag, len(b), b)) + tag, err := bacnetip.NewTag(bacnetip.NewArgs(model.TagClass_APPLICATION_TAGS, bacnetip.TagBitStringAppTag, len(b), b)) require.NoError(t, err) return tag } @@ -163,15 +147,15 @@ func TestBitStringSample(t *testing.T) { } func TestBitStringTag(t *testing.T) { - tag := Tag(bacnetip.TagApplicationTagClass, bacnetip.Tag_bitStringAppTag, 1, xtob("08")) + tag := Tag(bacnetip.TagApplicationTagClass, bacnetip.TagBitStringAppTag, 1, xtob("08")) obj := BitString(tag) assert.Len(t, obj.Value, 0) - tag = Tag(bacnetip.TagApplicationTagClass, bacnetip.Tag_bitStringAppTag, 1, xtob("0102")) + tag = Tag(bacnetip.TagApplicationTagClass, bacnetip.TagBitStringAppTag, 1, xtob("0102")) obj = BitString(tag) assert.Equal(t, []bool{false, false, false, false, false, false, true}, obj.Value) - tag = Tag(bacnetip.TagApplicationTagClass, bacnetip.Tag_bitStringAppTag, 1, xtob("")) + tag = Tag(bacnetip.TagApplicationTagClass, bacnetip.TagBitStringAppTag, 1, xtob("")) assert.Panics(t, func() { BitString(tag) }) diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_boolean_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_boolean_test.go new file mode 100644 index 00000000000..4076004c45d --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_boolean_test.go @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +import ( + "testing" + + "github.com/apache/plc4x/plc4go/internal/bacnetip" + "github.com/apache/plc4x/plc4go/protocols/bacnetip/readwrite/model" + + "github.com/stretchr/testify/assert" +) + +func Boolean(arg ...any) *bacnetip.Boolean { + if len(arg) == 0 { + boolean, err := bacnetip.NewBoolean(nil) + if err != nil { + panic(err) + } + return boolean + } + boolean, err := bacnetip.NewBoolean(arg[0]) + if err != nil { + panic(err) + } + return boolean +} + +func booleanTag(value bool) *bacnetip.Tag { + intValue := 0 + if value { + intValue = 1 + } + tag := Tag(model.TagClass_APPLICATION_TAGS, model.BACnetDataType_BOOLEAN, intValue, xtob("")) + return tag +} + +// Encode a Boolean object into a tag. +func booleanEncode(obj *bacnetip.Boolean) *bacnetip.Tag { + tag := Tag() + obj.Encode(tag) + return tag +} + +// Decode a boolean application tag into a boolean. +func booleanDecode(tag *bacnetip.Tag) *bacnetip.Boolean { + obj := Boolean(tag) + + return obj +} + +// Pass the value to Boolean, construct a tag from the hex string, +// +// and compare results of encode and decoding each other. +func booleanEndec(t *testing.T, v bool, x bool) { + tag := booleanTag(x) + + obj := Boolean(v) + + assert.Equal(t, tag, booleanEncode(obj)) + assert.Equal(t, obj, booleanDecode(tag)) +} + +func TestBoolean(t *testing.T) { + obj := Boolean() + assert.False(t, obj.GetBoolValue()) + + assert.Panics(t, func() { + Boolean("some string") + }) + assert.Panics(t, func() { + Boolean(1.0) + }) +} + +func TestBooleanBool(t *testing.T) { + obj := Boolean(false) + assert.Equal(t, false, obj.GetBoolValue()) + assert.Equal(t, "Boolean(False)", obj.String()) + + obj = Boolean(true) + assert.Equal(t, true, obj.GetBoolValue()) + assert.Equal(t, "Boolean(True)", obj.String()) +} + +func TestBooleanTag(t *testing.T) { + tag := Tag(model.TagClass_APPLICATION_TAGS, model.BACnetDataType_BOOLEAN, 1, xtob("01")) + obj := Boolean(tag) + assert.Equal(t, obj.GetValue(), 1) + + tag = Tag(model.TagClass_APPLICATION_TAGS, model.BACnetDataType_SIGNED_INTEGER, 0, xtob("")) + assert.Panics(t, func() { + Boolean(tag) + }) + + tag = Tag(model.TagClass_CONTEXT_SPECIFIC_TAGS, 0, 1, xtob("")) + assert.Panics(t, func() { + Boolean(tag) + }) + + tag = Tag(bacnetip.TagOpeningTagClass, 0) + assert.Panics(t, func() { + Boolean(tag) + }) +} + +func TestBooleanCopy(t *testing.T) { + obj1 := Boolean(true) + obj2 := Boolean(obj1) + assert.Equal(t, obj1, obj2) +} + +func TestBooleanEndec(t *testing.T) { + booleanEndec(t, false, false) + booleanEndec(t, true, true) +} diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_character_string_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_character_string_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_character_string_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_date_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_date_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_date_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_double_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_double_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_double_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_enumerated_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_enumerated_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_enumerated_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_integer_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_integer_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_integer_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_null_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_null_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_null_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_identifier_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_identifier_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_identifier_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_type_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_type_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_object_type_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_octet_string_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_octet_string_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_octet_string_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_real_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_real_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_real_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_tag_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_tag_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_tag_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_time_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_time_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_time_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_primitive_data/test_unsigned_test.go b/plc4go/internal/bacnetip/tests/test_primitive_data/test_unsigned_test.go new file mode 100644 index 00000000000..ed516b50110 --- /dev/null +++ b/plc4go/internal/bacnetip/tests/test_primitive_data/test_unsigned_test.go @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test_primitive_data + +// TODO: implement me diff --git a/plc4go/internal/bacnetip/tests/test_segmentation/test_1_test.go b/plc4go/internal/bacnetip/tests/test_segmentation/test_1_test.go index b333fcc609b..87f9edb399e 100644 --- a/plc4go/internal/bacnetip/tests/test_segmentation/test_1_test.go +++ b/plc4go/internal/bacnetip/tests/test_segmentation/test_1_test.go @@ -20,11 +20,11 @@ package test_segmentation import ( - "github.com/apache/plc4x/plc4go/internal/bacnetip/tests" "testing" "time" "github.com/apache/plc4x/plc4go/internal/bacnetip" + "github.com/apache/plc4x/plc4go/internal/bacnetip/tests" "github.com/apache/plc4x/plc4go/protocols/bacnetip/readwrite/model" "github.com/apache/plc4x/plc4go/spi/testutils" "github.com/apache/plc4x/plc4go/spi/utils"