public void ProducesExpectedArray() { var time32Type = new Time32Type(TimeUnit.Second); var array = new Time32Array.Builder(time32Type) .Append(1) .Build(); Assert.Equal(1, array.Length); var valueSeconds = array.GetSeconds(0); Assert.NotNull(valueSeconds); Assert.Equal(1, valueSeconds.Value); var valueMilliSeconds = array.GetMilliSeconds(0); Assert.NotNull(valueMilliSeconds); Assert.Equal(1_000, valueMilliSeconds.Value); time32Type = new Time32Type(TimeUnit.Millisecond); array = new Time32Array.Builder(time32Type) .Append(1_000) .Build(); Assert.Equal(1, array.Length); valueSeconds = array.GetSeconds(0); Assert.NotNull(valueSeconds); Assert.Equal(1, valueSeconds.Value); valueMilliSeconds = array.GetMilliSeconds(0); Assert.NotNull(valueMilliSeconds); Assert.Equal(1_000, valueMilliSeconds.Value); }
public void Visit(Time32Type type) { var builder = new Time32Array.Builder(type).Reserve(Length); for (var i = 0; i < Length; i++) { builder.Append(i); } Array = builder.Build(); }