Ejemplo n.º 1
0
        public void TestRoundTripOnComparisonExamples()
        {
            ComparisonExample[] examples = NumberComparisonExamples.GetComparisonExamples();
            bool success = true;

            for (int i = 0; i < examples.Length; i++)
            {
                ComparisonExample ce = examples[i];
                success &= ConfirmRoundTrip(i, ce.GetA());
                success &= ConfirmRoundTrip(i, ce.GetNegA());
                success &= ConfirmRoundTrip(i, ce.GetB());
                success &= ConfirmRoundTrip(i, ce.GetNegB());
            }
            if (!success)
            {
                throw new AssertionException("One or more cases failed.  See stderr");
            }
        }
        public static void Main(String[] args)
        {

            IWorkbook wb = new HSSFWorkbook();
            SheetWriter sw = new SheetWriter(wb);
            ComparisonExample[] ces = NumberComparisonExamples.GetComparisonExamples();
            for (int i = 0; i < ces.Length; i++)
            {
                ComparisonExample ce = ces[i];
                sw.AddTestRow(ce.GetA(), ce.GetB(), ce.GetExpectedResult());
            }


            FileInfo outputFile = new FileInfo("ExcelNumberCompare.xls");

            FileStream os = File.OpenWrite(outputFile.FullName);
            wb.Write(os);
            os.Close();

            Console.WriteLine("Finished writing '" + outputFile.FullName + "'");
        }