Skip to content

Commit

Permalink
Merge pull request #4 from bonk-dev/issue-3
Browse files Browse the repository at this point in the history
Real S7-1200/1500 support
  • Loading branch information
bonk-dev authored Aug 26, 2024
2 parents 47c3c8b + 3b725c1 commit b4ba7fa
Show file tree
Hide file tree
Showing 248 changed files with 58,271 additions and 387 deletions.
71 changes: 71 additions & 0 deletions HarpoS7.Family0.Tests/BitOperations/BigIntOperationsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using HarpoS7.Family0.BitOperations;
using HarpoS7.Family0.Tests.Utils;

namespace HarpoS7.Family0.Tests.BitOperations;

public class BigIntOperationsTests
{
[Test]
public void PrepareTest()
{
var srcBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("prep", false));
var expectedDstBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("prep", true));

var destinationBuffer = new byte[BigIntOperations.PrepareDestinationSize];
BigIntOperations.Prepare(destinationBuffer.AsSpan(), srcBytes.AsSpan());

Assert.That(destinationBuffer, Is.EqualTo(expectedDstBytes));
}

[Test]
public void FinalizeTest()
{
var srcBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("finalize", false));
var expectedDstBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("finalize", true));

var destinationBuffer = new byte[BigIntOperations.FinalizeDestinationSize];
BigIntOperations.Finalize(destinationBuffer.AsSpan(), srcBytes.AsSpan());

Assert.That(destinationBuffer, Is.EqualTo(expectedDstBytes));
}

[Test]
public void PrepareFinalizeMixTest()
{
var srcBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("mixed", false));
var expectedDstBytes = File.ReadAllBytes(BlobUtils.GetBitOperationBlobPath("mixed", true));

BigIntOperations.PrepareFinalize(srcBytes.AsSpan());

Assert.That(srcBytes, Is.EqualTo(expectedDstBytes));
}

[Test]
[TestCase(
new byte[]
{
0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
},
new byte[]
{
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0xF3
}
)]
[TestCase(
new byte[]
{
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0xF3
},
new byte[]
{
0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0xC9, 0x79
}
)]
public void RotateLeft31Test(byte[] dwords, byte[] expectedRotatedBytes)
{
BigIntOperations.RotateLeft31(dwords.AsSpan());
Assert.That(dwords, Is.EqualTo(expectedRotatedBytes));
}
}
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/BitOperations/finalize_src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�v�� >�H27}"����
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/BitOperations/prep_dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sv����=*&�6�x���-��
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
��(R� K,ښ+���>;�T�\�O�7�9�w�*�zS>�Z�8Z�
�5���� *K3�K���\�-ό
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ϧ�J�-:$����+���" !�x�/��M�~�ɮ���ν�"rH�>g����y)�3���U���BzW^
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith1-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���LX֬ ���7����4�Y�KO��w1[���S��]Ζܤ�WN^�N�n�x���t\�-��8��a<�
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith1-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
������������������������������������������������������������������������
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith11-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
y<���C٪�p^��#��Q
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith11-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'���-�x�T%����BY�� Z��x'���-�x�T%����BY�� Z��x'���-�x�T%��?�� |�p�41��Z�����i���w�����㥓`�:�����)��?��<u{�T���
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith2-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��_B�??0�W�7ɇ�睰
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith2-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sv�!��� 6�IS�@�q.Fq�H5T�N���=O(!:Br�nP�v�B�;Yٗ����ޱK���\�-ό
2 changes: 2 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith3-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
��?pk�]<˱����D�᧔�£�ɬ}� ��v�8 ��-�qdV(kdQ ����|�Ӱ��T�P�
I��&�۳zg%ms��A�ل�GQ���t>4����M ��1F*�EY���-HE���|~xe�!�Mb\CR��
Binary file not shown.
2 changes: 2 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith4-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
����Kp���ZR!hk�_)�����QP�BPO��
�ǣ����W����E�='���"�&��S�CڰZ
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith5-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�� @�����@nr_Se�j9 >�KJ��s�I[���vNG�7yC�������]NMF#���*8&�tS�B�Zj��G�i� �و��� l���:��� �.��ܑ 9p���]7+` �nc`��*~�B�;�̘�Y�s �JI���6�ݍjf��#���@��WKT�X��&�5L,6��y������ױ:��'%9�x���!�Mb\CR��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith6-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�ݰEv���Pt����홆�k��{Uc��%��݉E� ˱ uM9�w���RS�2NU{���ĕ�UB���ٯ�ᦍû���{�)�r�}\�w�b���'�ӭ�������r�B�奚Za�X����V�wZv����s�a�
2 changes: 2 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith6-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/JrX�0��rD�9�?�t蟐w�e��\����)bTP4��D��2� ��d2���R�?���?pk�]<˱����D�᧔�£�ɬ}� ��v�8 ��-�qdV(kdQ ����|�Ӱ��T�P�
I��&�۳zg%ms��A�ل�GQ���t>4����M ��1F*�EY���-HE���|~xe�!�Mb\CR��
Expand Down
4 changes: 4 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith7-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WN��{�����6�%@$��r���O���O"�af<�a<�b(�%����u�(f������W��h��=p�;�
� ྽? �����k��� O��������٨�=
���f��|���
܊wZv����s�a�
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith8-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���l�J�Mz��֍n7�.J�CrBKF?��/R��<���M����s��Xfh �a&a���
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Monoliths/monolith9-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��6�q��Ա5I�l"���+�0�
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform1-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'���-�x�T%����BY�� Z��x'���-�x�T%����BY�� Z��x'���-�x�T%��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform1-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
555555555555555555555555
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform13-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
?�� |�p�41��Z�����i���w�����㥓`�:�����)��?��<u{�T���
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform13-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
���-S�5ܣ(�>��g���b��ߎ�q�trKc�;������ ��Qr��~�m��e3�|��d
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform2-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'���-�x�T%����BY�� Z��x'���-�x�T%����BY�� Z��x'���-�x�T%��
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform4-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Gg"j.�����<��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform4-key.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%%%%%%%%%%%%%%%%
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform6-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
y<���C٪�p^��#��Q�V���pzz���)�!�U�--------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�V�i�"�!�q������ ]K�9[ �s�*�No�
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform6-t1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'���-�x�T%����BY�� Z��x'���-�x�T%����BY�� Z��x'���-�x�T%��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform7-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ϧ�J�-:$����+���" !�x�/��M�~�ɮ���ν�"rH�>g����y)�3���U���BzW^
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--------------------
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform7-src.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
� ��G�2azJ�Xn���.};g�����l�Li��5�W
3 changes: 3 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/Transforms/transform7_2-dst.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�c"���(z������+p�SH
h���[�`�͛���7�G�V��-��̅ �$ƨ�
_���U���BzW^
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�V�i�"�!�q������ ]K�9[ �s�*�No�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/3_in1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�榥"���BKQ�c�{��[ƀ�F���H�e�Tdv@�GP]r����>�G��0Q�%��T�<CC��
Expand Down
3 changes: 3 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/3_in2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zW��Np
洼X
�Op?{���~@��W2K<��wQ3�80���>qb^�r�y/��P_�2O ���U�C/ފ
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/3_in3.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/3_out1.bin
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/3_out2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[�˙&��zoCi��M�ϔ�UE���X&.5����I ��/@�AY���7x]���Tjl{�!�Mb\CR��
Expand Down
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/4_in1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+a�P\E�ޯ��An~2��H���_X�? G}$�?��c����g�ۏ���>Q֮��c�����P�S��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/4_in2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
����.�v�����a�y�<�4�Tg�b��S�m;�k�Q��@�}&�>�,�]����j�+�!�Mb\CR��
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/4_out1.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/5_in1.bin
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/5_in2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+a�P\E�ޯ��An~2��H���_X�? G}$�?��c����g�ۏ���>Q֮��c�����P�S��
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/5_in3.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
����.�v�����a�y�<�4�Tg�b��S�m;�k�Q��@�}&�>�,�]����j�+�!�Mb\CR��
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/5_out1.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/5_out2.bin
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/6_in1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/JrX�0��rD�9�?�t蟐w�e��\����)bTP4��D��2� ��d2���R�?�
Expand Down
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/6_in2.bin
Binary file not shown.
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/6_in3.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[�˙&��zoCi��M�ϔ�UE���X&.5����I ��/@�AY���7x]���Tjl{�!�Mb\CR��
Expand Down
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/6_out1.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/6_out2.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/7_in1.bin
Binary file not shown.
Binary file added HarpoS7.Family0.Tests/Blobs/WithCopy/7_in2.bin
Binary file not shown.
2 changes: 2 additions & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/7_out1.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C�[���/��e�跥b�1��� ����[m�!
f8GE=����d���xu�7�6٧����W��h�
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/Blobs/WithCopy/7_out2.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v�l�l��C��]sa����^ pi��ʼ�Bs������J,�V��|蚊M:wZv����s�a�
1 change: 1 addition & 0 deletions HarpoS7.Family0.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using NUnit.Framework;
Loading

0 comments on commit b4ba7fa

Please sign in to comment.