Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (48 sloc) 1.33 KB
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Numerics;
using Tcgv.QuantumSim.Operations;
namespace Tcgv.QuantumSim.Algorithms
{
[TestClass()]
public class DeutschAlgorithmTests
{
[TestMethod()]
public void BalancedGateTest()
{
var algo = new DeutschAlgorithm();
Assert.IsTrue(algo.IsBalanced(new BalancedGate()));
}
[TestMethod()]
public void ConstantGateTest()
{
var algo = new DeutschAlgorithm();
Assert.IsFalse(algo.IsBalanced(new ConstantGate()));
}
public class BalancedGate : BinaryOperation
{
protected override Complex[,] GetMatrix()
{
return new Complex[,]
{
{ 0, 0, 1, 0 },
{ 0, 1, 0, 0 },
{ 1, 0, 0, 0 },
{ 0, 0, 0, 1 }
};
}
}
public class ConstantGate : BinaryOperation
{
protected override Complex[,] GetMatrix()
{
return new Complex[,]
{
{ 1, 0, 0, 0 },
{ 0, 1, 0, 0 },
{ 0, 0, 1, 0 },
{ 0, 0, 0, 1 }
};
}
}
}
}
You can’t perform that action at this time.