Auto: ablegacy-7 — array contiguous block addressing

Closes #250
This commit is contained in:
Joseph Doherty
2026-04-25 23:36:01 -04:00
parent 05528bf71c
commit c689ac58b1
14 changed files with 779 additions and 15 deletions

View File

@@ -60,6 +60,25 @@ internal class FakeAbLegacyTag : IAbLegacyTagRuntime
return Value;
}
public virtual void EncodeValue(AbLegacyDataType type, int? bitIndex, object? value) => Value = value;
/// <summary>
/// PR 7 — array contiguous-block element decoder. Tests seed <see cref="ArrayValues"/>
/// with the per-index payload; the fake then returns each element in order. Falls back
/// to <see cref="Value"/> when the test only seeded a scalar (Convert.ChangeType handles
/// the cast back to the requested element type in the driver's BuildArray helper).
/// </summary>
public IReadOnlyList<object?>? ArrayValues { get; set; }
public AbLegacyDataType? LastArrayDecodeType { get; private set; }
public int LastArrayDecodeMaxIndex { get; private set; } = -1;
public virtual object? DecodeArrayElement(AbLegacyDataType type, int elementIndex)
{
LastArrayDecodeType = type;
if (elementIndex > LastArrayDecodeMaxIndex) LastArrayDecodeMaxIndex = elementIndex;
if (ArrayValues is not null && elementIndex < ArrayValues.Count)
return ArrayValues[elementIndex];
return Value;
}
public virtual void Dispose() => Disposed = true;
}