public void _09_UintArrayAttributeTest()
{
if (Platform.UnmanagedLongSize != 8 || Platform.StructPackingSize != 1)
Assert.Inconclusive("Test cannot be executed on this platform");
List<ulong> originalValue = new List<ulong>();
originalValue.Add(333333);
originalValue.Add(666666);
// Create attribute with ulong array value
using (ObjectAttribute attr = new ObjectAttribute(CKA.CKA_ALLOWED_MECHANISMS, originalValue))
{
Assert.IsTrue(attr.Type == (ulong)CKA.CKA_ALLOWED_MECHANISMS);
List<ulong> recoveredValue = attr.GetValueAsUlongList();
for (int i = 0; i < recoveredValue.Count; i++)
Assert.IsTrue(originalValue[i] == recoveredValue[i]);
}
originalValue = null;
// Create attribute with null ulong array value
using (ObjectAttribute attr = new ObjectAttribute(CKA.CKA_ALLOWED_MECHANISMS, originalValue))
{
Assert.IsTrue(attr.Type == (ulong)CKA.CKA_ALLOWED_MECHANISMS);
Assert.IsTrue(attr.GetValueAsUlongList() == originalValue);
}
originalValue = new List<ulong>();
// Create attribute with empty ulong array value
using (ObjectAttribute attr = new ObjectAttribute(CKA.CKA_ALLOWED_MECHANISMS, originalValue))
{
Assert.IsTrue(attr.Type == (ulong)CKA.CKA_ALLOWED_MECHANISMS);
Assert.IsTrue(attr.GetValueAsUlongList() == null);
}
}