package mf;

/*Generated by MPS */

import junit.framework.TestCase;
import java.util.GregorianCalendar;
import java.util.Calendar;
import org.junit.Assert;
import junit.textui.TestRunner;
import junit.framework.TestSuite;

public class MfDateTester extends TestCase {
  private MfDate myJan1;
  private MfDate myJan1a;
  private MfDate myJan1b;
  private MfDate myJan10;
  private MfDate myJustBefore;
  private MfDate myJustAfter;
  private DateRange myJan1To10;
  public MfDateTester(String arg) {
    super(arg);
  }
  private GregorianCalendar jan1() {
    return new GregorianCalendar(1999, 0, 1, 0, 0, 0);
  }
  @Override
  public void setUp() {
    myJan1 = new MfDate(jan1());
    GregorianCalendar gc = jan1();
    gc.add(Calendar.SECOND, -1);
    myJustBefore = new MfDate(gc);
    gc = jan1();
    gc.add(Calendar.SECOND, 1);
    myJustAfter = new MfDate(gc);
    myJan1a = new MfDate(new GregorianCalendar(1999, 0, 1, 7, 6, 34));
    gc = new GregorianCalendar(1999, 0, 2, 0, 0, 0);
    gc.add(Calendar.SECOND, -1);
    myJan1b = new MfDate(gc);
    myJan10 = new MfDate(new GregorianCalendar(1999, 0, 10, 7, 8, 9));
    myJan1To10 = new DateRange(myJan1, myJan10);
  }
  public void testAfter() {
    Assert.assertTrue(myJan1.after(myJustBefore));
    Assert.assertTrue(myJustBefore.before(myJan1));
    Assert.assertTrue(!(myJan1.after(myJan1)));
    Assert.assertTrue(myJustAfter.after(myJustBefore));
    Assert.assertTrue(!(myJan1.before(myJan1)));
  }
  public void testDateRange() {
    Assert.assertTrue(myJan1To10.includes(myJan1));
    Assert.assertTrue(myJan1To10.includes(myJan10));
    Assert.assertTrue(!(myJan1To10.includes(myJustBefore)));
  }
  public void testEquals() {
    Assert.assertEquals(myJan1, myJan1a);
    Assert.assertEquals("next day -1s", myJan1, myJan1b);
  }
  public void testJustBefore() {
    Assert.assertTrue(myJan1 != myJustBefore);
  }
  public void testSimple() {
    Assert.assertEquals(new MfDate(), new MfDate());
    Assert.assertEquals(myJan1, myJustAfter);
  }
  public void testToday() {
    MfDate.setToday(1999, 12, 1);
    Assert.assertEquals(new MfDate(1999, 12, 1), MfDate.today());
  }
  public void testCompare() {
    Assert.assertTrue(myJan1.compareTo(myJan10) < 0);
    Assert.assertTrue(myJan10.compareTo(myJan1) > 0);
    Assert.assertTrue(myJan1.compareTo(myJan1) == 0);
  }
  public static void main(String[] args) {
    TestRunner.run(new TestSuite(MfDateTester.class));
  }
}
