mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-18 23:33:16 +00:00
Move the EightBit (.Net) test projects to better locations.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
// <copyright file="ChipUnitTest.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace UnitTestEightBit
|
||||
{
|
||||
using EightBit;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
[TestClass]
|
||||
public class ChipUnitTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestLowByte()
|
||||
{
|
||||
ushort input = 0xf00f;
|
||||
byte low = Chip.LowByte(input);
|
||||
Assert.AreEqual(0xf, low);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestHighByte()
|
||||
{
|
||||
ushort input = 0xf00f;
|
||||
byte high = Chip.HighByte(input);
|
||||
Assert.AreEqual(0xf0, high);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClearFlag()
|
||||
{
|
||||
byte flags = 0xff;
|
||||
flags = Chip.ClearFlag(flags, 0x80);
|
||||
Assert.AreEqual(0x7f, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClearFlagNonZero()
|
||||
{
|
||||
byte flags = 0xff;
|
||||
flags = Chip.ClearFlag(flags, 0x80, 1);
|
||||
Assert.AreEqual(0x7f, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClearFlagZero()
|
||||
{
|
||||
byte flags = 0xff;
|
||||
flags = Chip.ClearFlag(flags, 0x80, 0);
|
||||
Assert.AreEqual(0xff, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClearFlagFalse()
|
||||
{
|
||||
byte flags = 0xff;
|
||||
flags = Chip.ClearFlag(flags, 0x80, false);
|
||||
Assert.AreEqual(0xff, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClearFlagTrue()
|
||||
{
|
||||
byte flags = 0xff;
|
||||
flags = Chip.ClearFlag(flags, 0x80, true);
|
||||
Assert.AreEqual(0x7f, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSetFlag()
|
||||
{
|
||||
byte flags = 0x7f;
|
||||
flags = Chip.SetFlag(flags, 0x80);
|
||||
Assert.AreEqual(0xff, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSetFlagNonZero()
|
||||
{
|
||||
byte flags = 0x7f;
|
||||
flags = Chip.SetFlag(flags, 0x80, 1);
|
||||
Assert.AreEqual(0xff, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSetFlagZero()
|
||||
{
|
||||
byte flags = 0x7f;
|
||||
flags = Chip.SetFlag(flags, 0x80, 0);
|
||||
Assert.AreEqual(0x7f, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSetFlagFalse()
|
||||
{
|
||||
byte flags = 0x7f;
|
||||
flags = Chip.SetFlag(flags, 0x80, false);
|
||||
Assert.AreEqual(0x7f, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSetFlagTrue()
|
||||
{
|
||||
byte flags = 0x7f;
|
||||
flags = Chip.SetFlag(flags, 0x80, true);
|
||||
Assert.AreEqual(0xff, flags);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestLowerPart()
|
||||
{
|
||||
ushort input = 0xf00f;
|
||||
ushort lower = Chip.LowerPart(input);
|
||||
Assert.AreEqual(0xf, lower);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestHigherPart()
|
||||
{
|
||||
ushort input = 0xf00f;
|
||||
ushort higher = Chip.HigherPart(input);
|
||||
Assert.AreEqual(0xf000, higher);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDemoteByte()
|
||||
{
|
||||
ushort input = 0xf00f;
|
||||
byte demoted = Chip.DemoteByte(input);
|
||||
Assert.AreEqual(0xf0, demoted);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestPromoteByte()
|
||||
{
|
||||
byte input = 0xf0;
|
||||
ushort promoted = Chip.PromoteByte(input);
|
||||
Assert.AreEqual(0xf000, promoted);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestLowNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.LowNibble(input);
|
||||
Assert.AreEqual(0xb, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestHighNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.HighNibble(input);
|
||||
Assert.AreEqual(0xa, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDemoteNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.DemoteNibble(input);
|
||||
Assert.AreEqual(0xa, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestPromoteNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.PromoteNibble(input);
|
||||
Assert.AreEqual(0xb0, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestHigherNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.HigherNibble(input);
|
||||
Assert.AreEqual(0xa0, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestLowerNibble()
|
||||
{
|
||||
byte input = 0xab;
|
||||
int nibble = Chip.LowerNibble(input);
|
||||
Assert.AreEqual(0xb, nibble);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMakeWord()
|
||||
{
|
||||
ushort word = Chip.MakeWord(0xcd, 0xab);
|
||||
Assert.AreEqual(0xabcd, word);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AA8282A3-212A-42DE-B778-BBAEB7E6D986}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EightBit.UnitTest</RootNamespace>
|
||||
<AssemblyName>EightBit.UnitTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChipUnitTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<AdditionalFiles Include="stylecop.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EightBit.csproj">
|
||||
<Project>{6ebf8857-62a3-4ef4-af21-c1844031d7e4}</Project>
|
||||
<Name>EightBit</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
|
||||
<Analyzer Include="..\packages\StyleCop.Analyzers.Unstable.1.1.1.61\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
@@ -0,0 +1,23 @@
|
||||
// <copyright file="AssemblyInfo.cs" company="Adrian Conlon">
|
||||
// Copyright (c) Adrian Conlon. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("UnitTestEightBit")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTestEightBit")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("aa8282a3-212a-42de-b778-bbaeb7e6d986")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
|
||||
<package id="StyleCop.Analyzers" version="1.1.1-beta.61" targetFramework="net472" developmentDependency="true" />
|
||||
<package id="StyleCop.Analyzers.Unstable" version="1.1.1.61" targetFramework="net472" developmentDependency="true" />
|
||||
</packages>
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
// ACTION REQUIRED: This file was automatically added to your project, but it
|
||||
// will not take effect until additional steps are taken to enable it. See the
|
||||
// following page for additional information:
|
||||
//
|
||||
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md
|
||||
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"documentationRules": {
|
||||
"documentInterfaces": false,
|
||||
"documentExposedElements": false,
|
||||
"documentInternalElements": false,
|
||||
"documentPrivateElements": false,
|
||||
"documentPrivateFields": false,
|
||||
"companyName": "Adrian Conlon"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user