Livt packages
Livt.Math
Version 1.7.2
Reusable integer and fixed-point arithmetic, complex numbers, trigonometry, and statistics for FPGA applications written in Livt.
Published files (90)
tests/arithmetic/UnsignedDivideInt32Test.lvt
namespace Livt.Math.Tests.Arithmetic
using Livt.Math.Arithmetic
/**
* Exercises UnsignedDivideInt32 with a shared fixture instance. Each scenario establishes
* the inputs and state it needs.
*/
@Test
component UnsignedDivideInt32Test
{
// Shared fixture instances, signals, and observation state.
divider: UnsignedDivideInt32
/**
* Creates the shared fixture instances (UnsignedDivideInt32). Tests initialize the state
* required by their scenario.
*/
new()
{
this.divider = new UnsignedDivideInt32()
}
/**
* Checks that Compute s floor quotients across the int32 range.
*/
@Test
fn ComputesFloorQuotientsAcrossTheInt32Range()
{
assert this.divider.Compute(-1, 1) == 0
assert this.divider.Compute(1, 0) == 0
assert this.divider.Compute(0, 5) == 0
assert this.divider.Compute(1, 1) == 1
assert this.divider.Compute(7, 2) == 3
assert this.divider.Compute(65536, 65536) == 1
assert this.divider.Compute(1073741824, 32768) == 32768
assert this.divider.Compute(2147483647, 2) == 1073741823
assert this.divider.Compute(2147483647, 2147483647) == 1
}
}