/******************************************************************************
 * 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
 *   Raduly, Csaba
 *
 ******************************************************************************/
module Txerobjclass
{
modulepar boolean Txerobjclass_verbose := false;
#define verbose Txerobjclass_verbose

#include "../macros.ttcnin"

import from ObjectClass           all;
import from ObjectClassWithSyntax all;
import from AsnValues all;

type component Tobjclass {}

external function flatten(inout universal charstring par) ;

const charstring add_str :=
"<MatOp>\n" &
"\t<op>add</op>\n" &
"\t<arg>\n" &
"\t\t<TwoMat>\n" &
"\t\t\t<left>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</left>\n" &
"\t\t\t<right>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</right>\n" &
"\t\t</TwoMat>\n" &
"\t</arg>\n" &
"\t<rez>\n" &
"\t\t<Matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</Matrix>\n" &
"\t</rez>\n" &
"</MatOp>\n" &
"\n";

const charstring add_str_ws :=
"<MatOpWS>\n" &
"\t<op>add</op>\n" &
"\t<arg>\n" &
"\t\t<TwoMatWS>\n" &
"\t\t\t<left>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</left>\n" &
"\t\t\t<right>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</right>\n" &
"\t\t</TwoMatWS>\n" &
"\t</arg>\n" &
"\t<rez>\n" &
"\t\t<MatrixWS>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</MatrixWS>\n" &
"\t</rez>\n" &
"</MatOpWS>\n" &
"\n";

const charstring sub_str :=
"<MatOp>\n" &
"\t<op>subtract</op>\n" &
"\t<arg>\n" &
"\t\t<TwoMat>\n" &
"\t\t\t<left>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</left>\n" &
"\t\t\t<right>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</right>\n" &
"\t\t</TwoMat>\n" &
"\t</arg>\n" &
"\t<rez>\n" &
"\t\t<Matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</Matrix>\n" &
"\t</rez>\n" &
"</MatOp>\n" &
"\n";

const charstring inv_str :=
"<MatOp>\n" &
"\t<op>invert</op>\n" &
"\t<arg>\n" &
"\t\t<Matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</Matrix>\n" &
"\t</arg>\n" &
"\t<rez>\n" &
"\t\t<Matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>-467</INTEGER>\n" &
"\t\t\t\t<INTEGER>-123</INTEGER>\n" &
"\t\t\t\t<INTEGER>79</INTEGER>\n" &
"\t\t\t\t<INTEGER>191</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>171</INTEGER>\n" &
"\t\t\t\t<INTEGER>57</INTEGER>\n" &
"\t\t\t\t<INTEGER>-39</INTEGER>\n" &
"\t\t\t\t<INTEGER>-67</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>326</INTEGER>\n" &
"\t\t\t\t<INTEGER>76</INTEGER>\n" &
"\t\t\t\t<INTEGER>-52</INTEGER>\n" &
"\t\t\t\t<INTEGER>-122</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>24</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t\t<INTEGER>10</INTEGER>\n" &
"\t\t\t\t<INTEGER>-18</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</Matrix>\n" &
"\t</rez>\n" &
"</MatOp>\n" &
"\n";

const charstring inv_str_ws :=
"<MatOpWS>\n" &
"\t<op>invert</op>\n" &
"\t<arg>\n" &
"\t\t<MatrixWS>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>4</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>2</INTEGER>\n" &
"\t\t\t\t<INTEGER>6</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t\t<INTEGER>5</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>7</INTEGER>\n" &
"\t\t\t\t<INTEGER>9</INTEGER>\n" &
"\t\t\t\t<INTEGER>3</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</MatrixWS>\n" &
"\t</arg>\n" &
"\t<rez>\n" &
"\t\t<MatrixWS>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>-467</INTEGER>\n" &
"\t\t\t\t<INTEGER>-123</INTEGER>\n" &
"\t\t\t\t<INTEGER>79</INTEGER>\n" &
"\t\t\t\t<INTEGER>191</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>171</INTEGER>\n" &
"\t\t\t\t<INTEGER>57</INTEGER>\n" &
"\t\t\t\t<INTEGER>-39</INTEGER>\n" &
"\t\t\t\t<INTEGER>-67</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>326</INTEGER>\n" &
"\t\t\t\t<INTEGER>76</INTEGER>\n" &
"\t\t\t\t<INTEGER>-52</INTEGER>\n" &
"\t\t\t\t<INTEGER>-122</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>24</INTEGER>\n" &
"\t\t\t\t<INTEGER>8</INTEGER>\n" &
"\t\t\t\t<INTEGER>10</INTEGER>\n" &
"\t\t\t\t<INTEGER>-18</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</MatrixWS>\n" &
"\t</rez>\n" &
"</MatOpWS>\n" &
"\n";


DECLARE_XER_ENCODERS(ObjectClass.MatOp, matop);

testcase encode_objclass() runs on Tobjclass
{
    var universal charstring expected;

    expected := add_str;
    CHECK_METHOD(bxer_enc_matop, ObjectClass.addition, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_matop, ObjectClass.addition, expected & lf);

    expected := inv_str;
    CHECK_METHOD(bxer_enc_matop, ObjectClass.inversion, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_matop, ObjectClass.inversion, expected & lf);
}

testcase decode_objclass() runs on Tobjclass
{
    var ObjectClass.MatOp expected;

    expected := ObjectClass.addition;
    CHECK_DECODE2(matop, add_str, ObjectClass.MatOp, expected);

  expected := ObjectClass.inversion;
  CHECK_DECODE2(matop, inv_str, ObjectClass.MatOp, expected);
}


DECLARE_XER_ENCODERS(ObjectClassWithSyntax.MatOpWS, matopws);

testcase encode_objclass_syntax() runs on Tobjclass
{
    var universal charstring expected;

    expected := add_str_ws;
    CHECK_METHOD(bxer_enc_matopws, ObjectClassWithSyntax.additionWS, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_matopws, ObjectClassWithSyntax.additionWS, expected & lf);

    expected := inv_str_ws;
    CHECK_METHOD(bxer_enc_matopws, ObjectClassWithSyntax.inversionWS, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_matopws, ObjectClassWithSyntax.inversionWS, expected & lf);
}

testcase decode_objclass_syntax() runs on Tobjclass
{
    var ObjectClassWithSyntax.MatOpWS expected;

    expected := ObjectClassWithSyntax.additionWS;
  CHECK_DECODE2(matopws, add_str_ws, ObjectClassWithSyntax.MatOpWS, expected);

  expected := ObjectClassWithSyntax.inversionWS;
  CHECK_DECODE2(matopws, inv_str_ws, ObjectClassWithSyntax.MatOpWS, expected);
}

// hmstr stands for handmade-string, NOT hamster !
const charstring hmstr_mul :=
"<AMatOp>\n" &
"\t<oph>mul</oph>\n" &
"\t<argh>\n" &
"\t\t<twoMat>\n" &
"\t\t\t<left>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</left>\n" &
"\t\t\t<right>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t</right>\n" &
"\t\t</twoMat>\n" &
"\t</argh>\n" &
"\t<rezh>\n" &
"\t\t<matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</matrix>\n" &
"\t</rezh>\n" &
"</AMatOp>\n" &
lf

const charstring hmstr_inv :=
"<AMatOp>\n" &
"\t<oph>inv</oph>\n" &
"\t<argh>\n" &
"\t\t<matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</matrix>\n" &
"\t</argh>\n" &
"\t<rezh>\n" &
"\t\t<matrix>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t\t<SEQUENCE_OF>\n" &
"\t\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t</SEQUENCE_OF>\n" &
"\t\t</matrix>\n" &
"\t</rezh>\n" &
"</AMatOp>\n" &
lf

DECLARE_XER_ENCODERS(AMatOp, amatop);
DECLARE_EXER_ENCODERS(AMatOp,amatop)
DECLARE_XER_ENCODERS(ATwoMat, atwomat);
DECLARE_EXER_ENCODERS(ATwoMat,atwomat)

testcase encode_handmade() runs on Tobjclass
{
    var universal charstring expected := hmstr_mul;
    CHECK_METHOD(bxer_enc_amatop, ObjectClassWithSyntax.matmul, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_amatop, ObjectClassWithSyntax.matmul, expected & lf);

    expected := hmstr_inv;
    CHECK_METHOD(bxer_enc_amatop, ObjectClassWithSyntax.matinv, expected);
    flatten(expected);
    CHECK_METHOD(cxer_enc_amatop, ObjectClassWithSyntax.matinv, expected & lf);
}

const charstring a2mstr :=
"<ATwoMat>\n" &
"\t<left>\n" &
"\t\t<SEQUENCE_OF>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t</SEQUENCE_OF>\n" &
"\t\t<SEQUENCE_OF>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t</SEQUENCE_OF>\n" &
"\t</left>\n" &
"\t<right>\n" &
"\t\t<SEQUENCE_OF>\n" &
"\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t</SEQUENCE_OF>\n" &
"\t\t<SEQUENCE_OF>\n" &
"\t\t\t<INTEGER>0</INTEGER>\n" &
"\t\t\t<INTEGER>1</INTEGER>\n" &
"\t\t</SEQUENCE_OF>\n" &
"\t</right>\n" &
"</ATwoMat>\n" &
lf;

testcase decode_handmade() runs on Tobjclass
{
    var ATwoMat a2m := { { {0,0}, {0,0} }, { {1,0}, {0,1} } }
    CHECK_DECODE2(atwomat, a2mstr, ATwoMat, a2m);
    //            suffix, input,     type,   expected
    CHECK_DECODE2(amatop, hmstr_mul, AMatOp, ObjectClassWithSyntax.matmul);
    CHECK_DECODE2(amatop, hmstr_inv, AMatOp, ObjectClassWithSyntax.matinv);
}

control
{
    execute(encode_handmade());
    execute(decode_handmade());

    execute(encode_objclass());
    execute(decode_objclass());

    execute(encode_objclass_syntax());
    execute(decode_objclass_syntax());
}

}
