public void Case_0() { var ls = new LogSystem(); ls.Put(1, "2017:01:01:23:59:59"); ls.Put(2, "2017:01:01:22:59:59"); ls.Put(3, "2016:01:01:00:00:00"); var result = ls.Retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Year").ToList(); result.Sort(); Assert.Equal(new [] { 1, 2, 3 }, result); result = ls.Retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Hour").ToList(); result.Sort(); Assert.Equal(new [] { 1, 2 }, result); }
public static void JudgeSquareSumCall() { //Console.WriteLine(JudgeSquareSum(0)); //Console.WriteLine(JudgeSquareSum(5)); //Console.WriteLine(JudgeSquareSum(4)); //Console.WriteLine(JudgeSquareSum(2)); //Console.WriteLine(JudgeSquareSum(6)); //Console.WriteLine(JudgeSquareSum(999999999)); //Console.WriteLine(JudgeSquareSum(1745882472)); LogSystem ls = new LogSystem(); ls.Put(1, "2017:01:01:23:59:59"); ls.Put(2, "2017:01:01:22:59:59"); ls.Put(3, "2016:01:01:00:00:00"); Console.WriteLine(ls.Retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Year")); // return [1,2,3], because you need to return all logs within 2016 and 2017. Console.WriteLine(ls.Retrieve("2016:01:01:01:01:01", "2017:01:01:23:00:00", "Hour")); }