예제 #1
0
		public void SetRelationsTest1()
		{
			SetRelations relations = new SetRelations();

			Set s1 = new Set(workspace, "1", false);
			Notion n1 = new Notion(s1, "1", true);

			relations.Add(s1);

			Contract.Assert(relations.Subsets(EmptySet, s1));
			Contract.Assert(relations.Subsets(s1, s1));
		}
예제 #2
0
		public void SetRelationsTest2()
		{
			SetRelations relations = new SetRelations();

			Set s1 = new Set(workspace, "1");
			Notion n1 = new Notion(s1, "1", true);

			relations.Add(s1);
			relations.Add(Booleans);

			Contract.Assert(relations.Subsets(EmptySet, s1));
			Contract.Assert(relations.Subsets(s1, s1));
			Contract.Assert(relations.Subsets(EmptySet, Booleans));
			Contract.Assert(relations.Subsets(Booleans, Booleans));
			Contract.Assert(relations.IsUnknown(Booleans, s1));
		}
예제 #3
0
		public void SetRelationsTest3()
		{
			SetRelations relations = new SetRelations();

			Set s1 = new Set(workspace, "1");
			Notion n1 = new Notion(s1, "1", true);

			Set s12 = new Set(workspace, "12");
			Notion n2 = new Notion(s12, "2", true);
			relations.Add(s1);
			relations.Add(s12);

			relations.AddSubsetRelation(s1, s12);

			Contract.Assert(relations.Subsets(EmptySet, s1));
			Contract.Assert(relations.Subsets(s1, s1));
			Contract.Assert(relations.Subsets(EmptySet, s12));
			Contract.Assert(relations.Subsets(s12, s12));
			Contract.Assert(relations.Subsets(s1, s12));
		}
예제 #4
0
		public void SetRelationsTest7()
		{
			SetRelations relations = new SetRelations();

			Set s1 = new Set(workspace, "1");
			Notion n1 = new Notion(s1, "1", true);

			Set s12 = new Set(workspace, "12");
			Notion n2 = new Notion(s12, "2", true);

			Set s3 = new Set(workspace, "3");
			Notion n3 = new Notion(s3, "3", true);

			Set s123 = new Set(workspace, "123");

			Set true1 = new Set(workspace, "true1");

			relations.Add(s1);
			relations.Add(s12);
			relations.Add(s3);
			relations.Add(s123);
			relations.Add(Booleans);
			relations.Add(true1);

			relations.AddSubsetRelation(s1, s12);
			relations.AddSubsetRelation(s12, s123);//should be able to infer s1 \in s123
			relations.AddSubsetRelation(s3, s123);
			relations.AddOverlapRelation(true1, Booleans);
			relations.AddSubsetRelation(s1, true1);

			Contract.Assert(relations.Subsets(s1, s12));
			Contract.Assert(relations.Subsets(s1, s123));
			Contract.Assert(relations.Subsets(s12, s123));
			Contract.Assert(relations.IsUnknown(s12, s3));
			Contract.Assert(relations.Intersects(true1, s12));//this one is nice
			Contract.Assert(relations.Intersects(true1, s123));
			Contract.Assert(relations.Intersects(true1, Booleans));

			relations.AddNoOverlapRelation(s12, s3);
			Contract.Assert(relations.Subsets(s1, s12));
			Contract.Assert(relations.Subsets(s1, s123));
			Contract.Assert(relations.Subsets(s12, s123));
			Contract.Assert(relations.Disjoins(s12, s3));
			Contract.Assert(relations.Intersects(true1, s12));
			Contract.Assert(relations.Intersects(true1, s123));
			Contract.Assert(relations.Intersects(true1, Booleans));
		}
예제 #5
0
		public void SetRelationsTest6()
		{
			SetRelations relations = new SetRelations();

			Set s1 = new Set(workspace, "1");
			Notion n1 = new Notion(s1, "1", true);

			Set s12 = new Set(workspace, "12");
			Notion n2 = new Notion(s12, "2", true);

			Set s3 = new Set(workspace, "3");
			Notion n3 = new Notion(s3, "3", true);

			Set s123 = new Set(workspace, "123");

			relations.Add(s1);
			relations.Add(s12);
			relations.Add(s3);
			relations.Add(s123);

			relations.AddSubsetRelation(s1, s12);
			relations.AddSubsetRelation(s12, s123);

			Contract.Assert(relations.Subsets(s1, s12));
			Contract.Assert(relations.Subsets(s1, s123));
			Contract.Assert(relations.Subsets(s12, s123));
			Contract.Assert(relations.IsUnknown(s12, s3));

			relations.AddOverlapRelation(s123, s3);

			Contract.Assert(relations.Subsets(s1, s12));
			Contract.Assert(relations.Subsets(s1, s123));
			Contract.Assert(relations.Subsets(s12, s123));
			Contract.Assert(relations.Intersects(s123, s3));
		}