This directory contains the unit test projects for the MixEmul solution.
Tests for the core MixLib library, including:
-
Type Tests (
Type/)MixByteTests.cs- Tests for the 6-bit MixByte type (constructors, operators, conversions)FullWordTests.cs- Tests for 5-byte FullWord type (value operations, sign handling, cloning)WordTests.cs- Tests for Word base class (static methods, slicing, magnitude operations)FieldSpecTests.cs- Tests for field specifications (bounds validation, byte indexing)ExtensionMethodsTests.cs- Tests for extension methods (sign operations, comparison values)MixByteCollectionTests.cs- Tests for MixByte collections (loading, cloning, enumeration)WordFieldTests.cs- Tests for word field operations (loading, applying, comparing)IndexRegisterTests.cs- Tests for 2-byte index registers with paddingAddressRegisterTests.cs- Tests for 2-byte address registersFullWordRegisterTests.cs- Tests for 5-byte registers
-
Core Component Tests
MemoryTests.cs- Tests for Memory class (indexing, bounds checking, storage)RegistersTests.cs- Tests for Registers collection (initialization, indexing, addressing)
-
Instruction Tests (
Instruction/)InstructionHelpersTests.cs- Tests for instruction utility methods
-
Misc Tests (
Misc/)ValidationErrorTests.cs- Tests for validation error messages and formatting
Total: 325 tests
Tests for the MixAssembler library, including:
-
Finding Tests (
Finding/)AssemblyFindingTests.cs- Tests for assembly errors and warnings (severity, location tracking, message formatting)
-
Value Tests (
Value/)NumberValueTests.cs- Tests for numeric literal parsing and value operations
Total: 46 tests
dotnet test MixEmul.slndotnet test tests\MixLib.Tests\MixLib.Tests.csproj
dotnet test tests\MixAssembler.Tests\MixAssembler.Tests.csprojdotnet test --verbosity detaileddotnet test --collect:"XPlat Code Coverage"- xUnit 2.9.2 - Modern, extensible test framework
- FluentAssertions 7.0.0 - Readable assertion library
- Target Framework: .NET 10 (net10.0-windows7.0)
These tests are designed to:
- Validate intent, not just implementation - Tests verify proper behavior, which may help identify bugs in production code
- Follow best practices - Using modern patterns like Theory/InlineData for parameterized tests
- Be maintainable - Clear naming, logical organization, and comprehensive coverage of core functionality
- Be fast - Unit tests run in milliseconds, suitable for frequent execution during development
The current test suite focuses on:
- Core type system (MixByte, Word, FullWord, FieldSpec)
- Type conversions and operators
- Validation and error reporting
- Extension methods for type manipulation
Future test additions could cover:
- Instruction execution
- Device I/O operations
- Memory and register operations
- Assembly parsing
- Mix computer simulation