title: Check Line Passes Origin
signature: function checkLinePassesOrigin(x1: number, y1: number, x2: number, y2: number): boolean {
source_py: def check_line_passes_origin(x1, y1, x2, y2):
      return ((x1 * (y2 - y1)) == (y1 * (x2 - x1)))
source_cpp: bool check_line_passes_origin(int x1, int y1, int x2, int y2) {
    return ( x1 * ( y2 - y1 ) == y1 * ( x2 - x1 ) );
  }
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"x1": 1, "y1": 28, "x2": 2, "y2": 56}}, {"idx": 1, "outputs": true, "inputs": {"x1": 10, "y1": 0, "x2": 20, "y2": 0}}, {"idx": 2, "outputs": true, "inputs": {"x1": 0, "y1": 1, "x2": 0, "y2": 17}}, {"idx": 3, "outputs": true, "inputs": {"x1": 1, "y1": 1, "x2": 10, "y2": 10}}, {"idx": 4, "outputs": false, "inputs": {"x1": 82, "y1": 86, "x2": 19, "y2": 4}}, {"idx": 5, "outputs": false, "inputs": {"x1": 78, "y1": 86, "x2": 11, "y2": 6}}, {"idx": 6, "outputs": false, "inputs": {"x1": 13, "y1": 46, "x2": 33, "y2": 33}}, {"idx": 7, "outputs": false, "inputs": {"x1": 18, "y1": 29, "x2": 95, "y2": 12}}, {"idx": 8, "outputs": false, "inputs": {"x1": 42, "y1": 35, "x2": 25, "y2": 36}}, {"idx": 9, "outputs": false, "inputs": {"x1": 29, "y1": 17, "x2": 45, "y2": 35}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: boolean, expected: boolean): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(x1: number, y1: number, x2: number, y2: number, expected:boolean): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(x1, y1, x2, y2),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(1, 28, 2, 56, true);
    console.log(`TEST-0...${result}`);
  
    result = driver(10, 0, 20, 0, true);
    console.log(`TEST-1...${result}`);
  
    result = driver(0, 1, 0, 17, true);
    console.log(`TEST-2...${result}`);
  
    result = driver(1, 1, 10, 10, true);
    console.log(`TEST-3...${result}`);
  
    result = driver(82, 86, 19, 4, false);
    console.log(`TEST-4...${result}`);
  
    result = driver(78, 86, 11, 6, false);
    console.log(`TEST-5...${result}`);
  
    result = driver(13, 46, 33, 33, false);
    console.log(`TEST-6...${result}`);
  
    result = driver(18, 29, 95, 12, false);
    console.log(`TEST-7...${result}`);
  
    result = driver(42, 35, 25, 36, false);
    console.log(`TEST-8...${result}`);
  
    result = driver(29, 17, 45, 35, false);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: checkLinePassesOrigin
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js