v2
5/20/2019 by katlasik -00
Setup HTML - click to add setup HTML
Setup JS - click to add setup JavaScript
delete caserun single casemove downdrag and drop case


ready



const costFunction = (user, object) => {
  switch (object.type){
    case 0:
      if(user.access[0]){
        return object.cost * user.utility[0];
      }else{
        return Infinity;
      };
    case 1:
      if(user.access[1]){
        return object.cost * user.utility[1];
      }else{
        return Infinity;
      };
  };
};

for(var i=0; i < 500; i++) {
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 15})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 15})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 215})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 215})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 125})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 125})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 2145})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 2145})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 55})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 55})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 0, cost: 55})
    costFunction({  access: [true, false],   utility: [2, 5]}, {type: 1, cost: 55})
  
}
delete caserun single casemove updrag and drop case


ready



const costFunctionCurried = (user) => (object) => {
  switch (object.type){
    case 0:
      if(user.access[0]){
        return object.cost * user.utility[0];
      }else{
        return Infinity;
      };
    case 1:
      if(user.access[1]){
        return object.cost * user.utility[1];
      }else{
        return Infinity;
      };
  };
};

const curried1 = costFunctionCurried({ access: [true, false], utility: [2, 5]})

for(let i=0; i < 500; i++) {
    costFunctionCurried({type: 0, cost: 15})
    costFunctionCurried({type: 1, cost: 15})
    costFunctionCurried({type: 0, cost: 215})
    costFunctionCurried({type: 1, cost: 215})
    costFunctionCurried({type: 0, cost: 125})
    costFunctionCurried({type: 1, cost: 125})
    costFunctionCurried({type: 0, cost: 2145})
    costFunctionCurried({type: 1, cost: 2145})
    costFunctionCurried({type: 0, cost: 55})
    costFunctionCurried({type: 1, cost: 55})
    costFunctionCurried({type: 0, cost: 55})
    costFunctionCurried( {type: 1, cost: 55})
}
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN