package net.murakamin.sticker.commands;

import junit.framework.TestCase;

public class VersionTermTest extends TestCase
{
	public void testAfterInThePeriod() throws Exception
	{
		VersionTerm term = new VersionTerm("1.0", "2.0");

		try
		{
			term.compare("2.1");
			super.fail();
		} catch (Exception e)
		{

		}
		try
		{
			term.compare("2.0a");
			super.fail();
		} catch (Exception e)
		{

		}
	}

	public void testInEffectivePeriod() throws Exception
	{
		VersionTerm term = new VersionTerm("1.0", "2.0");
		term.compare("1.5");

		term = new VersionTerm("1.0", "2.0");
		term.compare("1.5a");

		term = new VersionTerm("1.0", "2.0");
		term.compare("1.0");

		term = new VersionTerm("1.0", "2.0");
		term.compare("2.0");

		term = new VersionTerm("1.0", "2.0");
		term.compare("1.0a");
	}

	public void testPreviousInThePeriod() throws Exception
	{
		VersionTerm term = new VersionTerm("1.0", "2.0");

		try
		{
			term.compare("0.9");
			super.fail();
		} catch (Exception e)
		{

		}
		try
		{
			term.compare("0.9a");
			super.fail();
		} catch (Exception e)
		{

		}
	}

}
