Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IComparable<T> Tests #4

Open
Grauenwolf opened this issue Jun 2, 2021 · 0 comments
Open

IComparable<T> Tests #4

Grauenwolf opened this issue Jun 2, 2021 · 0 comments

Comments

@Grauenwolf
Copy link
Owner

    @Tag("IComparable")
	@TestAttribute
    public void @(Test.ClassName + "_IComparableT")()
	{
		var values = CreateOrderedSet();
		var item1 = (IComparable<@Class.FullName>)values.Item1;
		var item2 = (IComparable<@Class.FullName>)values.Item2;
		var item3 = (IComparable<@Class.FullName>)values.Item3;
		var item4 = (IComparable<@Class.FullName>)values.Item4;

		@{
			if (Class.IsNullable)
			{ 	
			<text>
					@Assert.IsTrue("item1.CompareTo((" + Class.FullName + ")null) > 0");
					@Assert.IsTrue("item2.CompareTo((" + Class.FullName + ")null) > 0");
					@Assert.IsTrue("item3.CompareTo((" + Class.FullName + ")null) > 0");
					@Assert.IsTrue("item4.CompareTo((" + Class.FullName + ")null) > 0");
			</text>
			}
		}										  
		@Assert.IsTrue("item1.CompareTo((" + Class.FullName + ")item1) == 0");
		@Assert.IsTrue("item1.CompareTo((" + Class.FullName + ")item2) < 0");
		@Assert.IsTrue("item1.CompareTo((" + Class.FullName + ")item3) < 0");
		@Assert.IsTrue("item1.CompareTo((" + Class.FullName + ")item4) < 0");
	  
		@Assert.IsTrue("item2.CompareTo((" + Class.FullName + ")item1) > 0");
		@Assert.IsTrue("item2.CompareTo((" + Class.FullName + ")item2) == 0");
		@Assert.IsTrue("item2.CompareTo((" + Class.FullName + ")item3) < 0");
		@Assert.IsTrue("item2.CompareTo((" + Class.FullName + ")item4) < 0");

		@Assert.IsTrue("item3.CompareTo((" + Class.FullName + ")item1) > 0");
		@Assert.IsTrue("item3.CompareTo((" + Class.FullName + ")item2) > 0");
		@Assert.IsTrue("item3.CompareTo((" + Class.FullName + ")item3) == 0");
		@Assert.IsTrue("item3.CompareTo((" + Class.FullName + ")item4) == 0");

		@Assert.IsTrue("item4.CompareTo((" + Class.FullName + ")item1) > 0");
		@Assert.IsTrue("item4.CompareTo((" + Class.FullName + ")item2) > 0");
		@Assert.IsTrue("item4.CompareTo((" + Class.FullName + ")item3) == 0");
		@Assert.IsTrue("item4.CompareTo((" + Class.FullName + ")item4) == 0");

	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant