ESM: Tidied up Set operations

This commit is contained in:
n1474335 2018-04-11 17:29:02 +00:00
parent 955a082614
commit e99331f305
12 changed files with 81 additions and 487 deletions

View file

@ -12,18 +12,7 @@ TestRegister.addTests([
{
name: "Cartesian Product",
input: "1 2 3 4 5\n\na b c d e",
expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e)",
recipeConfig: [
{
op: "Cartesian Product",
args: ["\n\n", " "],
},
],
},
{
name: "Cartesian Product: wrong sample count",
input: "1 2\n\n3 4 5\n\na b c d e",
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -34,7 +23,7 @@ TestRegister.addTests([
{
name: "Cartesian Product: too many on left",
input: "1 2 3 4 5 6\n\na b c d e",
expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e) (6,undefined)",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -45,7 +34,7 @@ TestRegister.addTests([
{
name: "Cartesian Product: too many on right",
input: "1 2 3 4 5\n\na b c d e f",
expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e) (undefined,f)",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
recipeConfig: [
{
op: "Cartesian Product",
@ -56,7 +45,7 @@ TestRegister.addTests([
{
name: "Cartesian Product: item delimiter",
input: "1-2-3-4-5\n\na-b-c-d-e",
expectedOutput: "(1,a)-(2,b)-(3,c)-(4,d)-(5,e)",
expectedOutput: "(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -67,7 +56,7 @@ TestRegister.addTests([
{
name: "Cartesian Product: sample delimiter",
input: "1 2 3 4 5_a b c d e",
expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e)",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
recipeConfig: [
{
op: "Cartesian Product",

View file

@ -64,235 +64,4 @@ TestRegister.addTests([
},
],
},
// {
// name: "Set Operations: Intersection",
// input: "1 2 3 4 5\n\n3 4 5 6 7",
// expectedOutput: "3 4 5",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Intersection"],
// },
// ],
// },
// {
// name: "Set Operations: Intersection: only one set",
// input: "1 2 3 4 5 6 7 8",
// expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Intersection"],
// },
// ],
// },
// {
// name: "Set Operations: Intersection: item delimiter",
// input: "1-2-3-4-5\n\n3-4-5-6-7",
// expectedOutput: "3-4-5",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", "-", "Intersection"],
// },
// ],
// },
// {
// name: "Set Operations: Intersection: sample delimiter",
// input: "1-2-3-4-5z3-4-5-6-7",
// expectedOutput: "3-4-5",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["z", "-", "Intersection"],
// },
// ],
// },
// {
// name: "Set Operations: Set Difference",
// input: "1 2 3 4 5\n\n3 4 5 6 7",
// expectedOutput: "1 2",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Set Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Set Difference: wrong sample count",
// input: "1 2 3 4 5_3_4 5 6 7",
// expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
// recipeConfig: [
// {
// op: "Set Operations",
// args: [" ", "_", "Set Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Set Difference: item delimiter",
// input: "1;2;3;4;5\n\n3;4;5;6;7",
// expectedOutput: "1;2",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", ";", "Set Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Set Difference: sample delimiter",
// input: "1;2;3;4;5===3;4;5;6;7",
// expectedOutput: "1;2",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["===", ";", "Set Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Symmetric Difference",
// input: "1 2 3 4 5\n\n3 4 5 6 7",
// expectedOutput: "1 2 6 7",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Symmetric Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Symmetric Difference: wrong sample count",
// input: "1 2\n\n3 4 5\n\n3 4 5 6 7",
// expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Symmetric Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Symmetric Difference: item delimiter",
// input: "a_b_c_d_e\n\nc_d_e_f_g",
// expectedOutput: "a_b_f_g",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", "_", "Symmetric Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Symmetric Difference: sample delimiter",
// input: "a_b_c_d_eAAAAAc_d_e_f_g",
// expectedOutput: "a_b_f_g",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["AAAAA", "_", "Symmetric Difference"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product",
// input: "1 2 3 4 5\n\na b c d e",
// expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e)",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product: wrong sample count",
// input: "1 2\n\n3 4 5\n\na b c d e",
// expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product: too many on left",
// input: "1 2 3 4 5 6\n\na b c d e",
// expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e) (6,undefined)",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product: too many on right",
// input: "1 2 3 4 5\n\na b c d e f",
// expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e) (undefined,f)",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product: item delimiter",
// input: "1-2-3-4-5\n\na-b-c-d-e",
// expectedOutput: "(1,a)-(2,b)-(3,c)-(4,d)-(5,e)",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", "-", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Cartesian Product: sample delimiter",
// input: "1 2 3 4 5_a b c d e",
// expectedOutput: "(1,a) (2,b) (3,c) (4,d) (5,e)",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["_", " ", "Cartesian Product"],
// },
// ],
// },
// {
// name: "Set Operations: Power set: nothing",
// input: "",
// expectedOutput: "",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Power Set"],
// },
// ],
// },
// {
// name: "Set Operations: Power set: Too many samples",
// input: "1 2 3\n\n4",
// expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Power Set"],
// },
// ],
// },
// {
// name: "Set Operations: Power set",
// input: "1 2 4",
// expectedOutput: "\n4\n2\n1\n2 4\n1 4\n1 2\n1 2 4\n",
// recipeConfig: [
// {
// op: "Set Operations",
// args: ["\n\n", " ", "Power Set"],
// },
// ],
// },
]);