/******************************************************************************
 * Copyright (c) 2000-2025 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
 *
 * Contributors:
 *   Balasko, Jeno
 *   Baranyi, Botond
 *
 ******************************************************************************/
module HS16977_Test {
  import from HS16977_Constants all;
  import from HS16977_Types all;

  external function ef_enc(in t_outer_rec pl_pdu, out octetstring pl_stream) with {
    extension "prototype(fast)";
    extension "encode(RAW)"; 
  }

  external function ef_dec(in octetstring pl_stream, out t_outer_rec pl_pdu) with {
    extension "prototype(fast)";
    extension "decode(RAW)"; 
  }

  type component CT_empty {};

  testcase tc_hs16977() runs on CT_empty {
    var t_outer_rec v_initial := {
      len := 10,
      inner := {
        obj_type := c_outer_choice,
        len := 6,
        val := {
          outer := {
            len := 4,
            inner := {
              obj_type := c_float_choice,
              len := 2,
              val := { f := 3.14 }
            }
          }
        }
      }
    };

    var octetstring v_coded;
    ef_enc(v_initial, v_coded);

    var t_outer_rec v_result;
    ef_dec(v_coded, v_result);
    
    if (v_result == v_initial) { setverdict(pass); }
    else { setverdict(fail); }
  }

control {
  execute(tc_hs16977());
}

} with {
  encode "RAW";
}
