internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Business252 obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
public void testBusiness252() { // Testing business/252 day counter List <Date> testDates = new List <Date>(); testDates.Add(new Date(1, Month.February, 2002)); testDates.Add(new Date(4, Month.February, 2002)); testDates.Add(new Date(16, Month.May, 2003)); testDates.Add(new Date(17, Month.December, 2003)); testDates.Add(new Date(17, Month.December, 2004)); testDates.Add(new Date(19, Month.December, 2005)); testDates.Add(new Date(2, Month.January, 2006)); testDates.Add(new Date(13, Month.March, 2006)); testDates.Add(new Date(15, Month.May, 2006)); testDates.Add(new Date(17, Month.March, 2006)); testDates.Add(new Date(15, Month.May, 2006)); testDates.Add(new Date(26, Month.July, 2006)); testDates.Add(new Date(28, Month.June, 2007)); testDates.Add(new Date(16, Month.September, 2009)); testDates.Add(new Date(26, Month.July, 2016)); double[] expected = { 0.0039682539683, 1.2738095238095, 0.6031746031746, 0.9960317460317, 1.0000000000000, 0.0396825396825, 0.1904761904762, 0.1666666666667, -0.1507936507937, 0.1507936507937, 0.2023809523810, 0.912698412698, 2.214285714286, 6.84126984127 }; DayCounter dayCounter1 = new Business252(new Brazil()); double calculated; for (int i = 1; i < testDates.Count; i++) { calculated = dayCounter1.yearFraction(testDates[i - 1], testDates[i]); if (Math.Abs(calculated - expected[i - 1]) > 1.0e-12) { QAssert.Fail("from " + testDates[i - 1] + " to " + testDates[i] + ":\n" + " calculated: " + calculated + "\n" + " expected: " + expected[i - 1]); } } DayCounter dayCounter2 = new Business252(); for (int i = 1; i < testDates.Count; i++) { calculated = dayCounter2.yearFraction(testDates[i - 1], testDates[i]); if (Math.Abs(calculated - expected[i - 1]) > 1.0e-12) { QAssert.Fail("from " + testDates[i - 1] + " to " + testDates[i] + ":\n" + " calculated: " + calculated + "\n" + " expected: " + expected[i - 1]); } } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Business252 obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }