module list-set-test
imports libstratego-lib
strategies 

 main = 
    test-suite(!"list-set-test",
	test1a;
	test1b;  
	test1c;
	test1d;
	test1e;

	test2a;
	test2b;  
	test2c;
	test2d;
	test2e;

	test3a;
	test3b;  
	test3c;
	test3d;
	test3e;

	test4a;
	test4b;  
	test4c;
	test4d;
	test4e;
  
  set-eq-test-1;
  set-eq-test-2;
  set-eq-test-3;
  set-eq-test-4;
  set-eq-test-5

     )

/**
 * union
 */ 
  test1a = 
    apply-test(!"test1a"
	, union
	, !(["a","b"],["c","d"])
	, !["a","b","c","d"]
	)

  test1b =
    apply-test(!"test1b"
	, union
	, !(["a","b"],["b","d"])
	, !["a","b","d"]
	)

  test1c = 
    apply-test(!"test1c"
	, union
	, !([],["c","d"])
	, !["c","d"]
	)

  test1d =
    apply-test(!"test1d"
	, union
	, !(["a","b"],[])
	, !["a","b"]
	)

  test1e =
    apply-test(!"test1e"
	, union
	, !([],[])
	, ![]
	)

/**
 * isect
 */ 
  test2a = 
    apply-test(!"test2a"
	, isect
	, !(["a","b"],["c","d"])
	, ![]
	)

  test2b =
    apply-test(!"test2b"
	, isect
	, !(["a","b"],["b","d"])
	, !["b"]
	)

  test2c = 
    apply-test(!"test2c"
	, isect
	, !([],["c","d"])
	, ![]
	)

  test2d =
    apply-test(!"test2d"
	, isect
	, !(["a","b"],[])
	, ![]
	)

  test2e =
    apply-test(!"test2e"
	, isect
	, !([],[])
	, ![]
	)

/**
 * diff
 */ 
  test3a = 
    apply-test(!"test3a"
	, diff
	, !(["a","b"],["c","d"])
	, !["a", "b"]
	)

  test3b =
    apply-test(!"test3b"
	, diff
	, !(["a","b"],["b","d"])
	, !["a"]
	)

  test3c = 
    apply-test(!"test3c"
	, diff
	, !([],["c","d"])
	, ![]
	)

  test3d =
    apply-test(!"test3d"
	, diff
	, !(["a","b"],[])
	, !["a", "b"]
	)

  test3e =
    apply-test(!"test3e"
	, diff
	, !([],[])
	, ![]
	)

/**
 * sym-diff
 */ 
  test4a = 
    apply-test(!"test4a"
	, sym-diff
	, !(["a","b"],["c","d"])
	, !["a","b", "c","d"]
	)

  test4b =
    apply-test(!"test4b"
	, sym-diff
	, !(["a","b"],["b","d"])
	, !["a", "d"]
	)

  test4c = 
    apply-test(!"test4c"
	, sym-diff
	, !([],["c","d"])
	, !["c", "d"]
	)

  test4d =
    apply-test(!"test4d"
	, sym-diff
	, !(["a","b"],[])
	, !["a", "b"]
	)

  test4e =
    apply-test(!"test4e"
	, sym-diff
	, !([],[])
	, ![]
	)

/**
 * Set Equality
 */
strategies

  set-eq-test-1 =
  apply-test(
    set-eq(eq)
  | "set-eq-test-1"
  , ([1, 2, 3, 4], [4, 1, 3, 2])
  )

  set-eq-test-2 =
  apply-and-fail(
    set-eq(eq)
  | "set-eq-test-2"
  , ([1, 2, 3, 4], [4, 1, 3, 0, 2])
  )

  set-eq-test-3 =
  apply-and-fail(
    set-eq(eq)
  | "set-eq-test-3"
  , ([1, 2, 3, 4], [])
  )

  set-eq-test-4 =
  apply-and-fail(
    set-eq(eq)
  | "set-eq-test-4"
  , ([1, 2, 3], [4, 1, 3, 2])
  )

  set-eq-test-5 =
  apply-and-fail(
    set-eq(eq)
  | "set-eq-test-5"
  , ([1, 2, 3], [4, 1, 3, 2])
  )
