//
// Author: Carson Jones
// Adapted from "Art of Multiprocessor Programming" by Herlihy and Shavit
// CS6966
//
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ReadWriteLock;
namespace TestFifoReadWriteLock
{
///
/// Summary description for UnitTest1
///
[TestClass]
public class UnitTest1
{
public UnitTest1()
{
}
private TestContext testContextInstance;
///
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// Use TestCleanup to run code after each test has run
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#endregion
[TestMethod]
[HostType("Chess")]
[TestProperty("ChessDebug", "true")]
public void TestMethod1()
{
// One reader thread, one writer thread
ReadWriteRunner rwr = new ReadWriteRunner(1, 1);
rwr.Run(1);
}
[TestMethod]
[HostType("Chess")]
[TestProperty("ChessDebug", "true")]
public void TestMethod2()
{
// Two reader threads, one writer thread
ReadWriteRunner rwr = new ReadWriteRunner(2, 1);
rwr.Run(1);
}
[TestMethod]
[HostType("Chess")]
[TestProperty("ChessDebug", "true")]
/*
* These are the properties CHESS produces to reproduce a problematic schedule I had. Left for illustration.
[TestProperty("ChessMode", "Repro")]
[TestProperty("ChessBreak", "BeforePreemption")]
#region ChessScheduleString (not human readable)
[TestProperty("ChessScheduleString", @"bpilaiaaaaaaaaaaaeaaonlnahgabmejjgcfcgcpgnmkhlhpekpfeknhoahekbaiiagabdcenijaeabaommbiimnogjcombngjeh
cdcjklckibmkgffggffnggbgeammonjnlmphnohloplnphnohloplnphlkdljneochphnpppdpfmgggeabgmpgmoeknkmjjocbia
kkmibpdphohmbpdpcchomnfpodnhpidfpappippfohpppnglmkeppdplgpkblpppfkpeppfpfhhppplflnnphpbnopphfpnhplbn
onhpmmglgphopphflmnphpfnpnpnnhncpppphkpkbdppjimppampkpkdlpodpplpkbmcmdpphpdnpngjnkjlnphpbnpnbnppehpl
fpehppppolojmpfpfdnlddnmmoopggdmpilpnpnomadahnnnageophphcobmeldlhnbhlpbldioghhlpinkbidipidibgdpoppol
ppbkiomolpmbkpobgipngloiephpeomnppmngdhoeplmphhpcnpjoinhpienhoanpjmdncpjnhbadiogldfpfhdpplgnhpanmbpf
nhjckpomghnnhgdpoohnggnkpngonoghppphppadaaodjlaajjacaaaa")]
#endregion*/
public void TestMethod3()
{
// Two reader threads, two writer threads
ReadWriteRunner rwr = new ReadWriteRunner(2, 2);
rwr.Run(1);
}
}
}