Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

33 lines
659 B
C#

using System;
using System.Threading;
using System.Diagnostics;
public class Tests
{
static bool finished;
public static int Main (String[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
public static int test_0_time_drift () {
// Test the Thread.Sleep () is able to deal with time drifting due to interrupts
Thread t = new Thread (delegate () {
while (!finished)
GC.Collect ();
});
t.Start ();
var sw = Stopwatch.StartNew ();
Thread.Sleep (1000);
finished = true;
sw.Stop ();
if (sw.ElapsedMilliseconds > 2000) {
Console.WriteLine (sw.ElapsedMilliseconds);
return 1;
} else {
return 0;
}
}
}