This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C123GH6PM: Object Oriented Programming Support DSS

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

I have a simple TM4cGH6PM Code , where I have to write a unit test to automatically test the 

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
int summer(int a,int b);
int i=0;
int a;
int b;
int c;
int m;int x1=5;
int x2=10;
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
m=summer(x1,x2);
}

int summer(int a,int b)
{
	c=a+b;
    return c;
}

I have written the code in this way to test the code just to learn the basic  , and it works fine

// Import the DSS packages into our namespace to save on typing
importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage(Packages.java.lang);

print("New Code Under Execution");
//buildProject "red_led";

// Modify these variables to match your environment. Use forward slashes
var ccs5InstallDir = "C:/ti";
var DSSWorkshopDir = "C:/CCSWorkshop/dss"
var deviceCCXMLFile = DSSWorkshopDir + "/lab1/StellarisLaunchPad.ccxml";

var programToLoad = DSSWorkshopDir + "/workspace/Simple_Trial2/Debug/Simple_Trial2.out";

var logFile = DSSWorkshopDir + "/workspace/Simple_Trial2/log.xml";

// Create our scripting environment object - which is the main entry point 
// into any script and the factory for creating other Scriptable Servers and Sessions
var script = ScriptingEnvironment.instance();

// Create a log file in the current directory to log script execution
script.traceBegin(logFile, ccs5InstallDir + 

"/ccsv6/ccs_base/scripting/examples/DebugServerExamples/DefaultStylesheet.xsl");

// Set trace levels for console and logs
script.traceSetConsoleLevel(TraceLevel.INFO);
script.traceSetFileLevel(TraceLevel.ALL);

script.traceWrite("Begin scripting session");

// Get the Debug Server and start a Debug Session
var debugServer = script.getServer("DebugServer.1");
debugServer.setConfig(deviceCCXMLFile);
var debugSession = debugServer.openSession(".*");

// Check to see if target is already connected
// target.isConnected() API will return 'true' is connected
if (!debugSession.target.isConnected())
{
  // Connect to the CPU
  debugSession.target.connect();
}

// Load a program
debugSession.memory.loadProgram(programToLoad);
debugSession.breakpoint.removeAll();


var start=0;
var end =10;


while(start<10)
{

var addr_x1=debugSession.symbol.getAddress("x1");
print("Address of x1",addr_x1);
debugSession.memory.writeData(0, addr_x1, start, 16); // This writes your_data to the global 

variable a.
var val_x1=debugSession.memory.readWord(0,addr_x1);
print("Value of x1",val_x1); 

var addr_x2=debugSession.symbol.getAddress("x2");
print("Address  of x2",addr_x2);
debugSession.memory.writeData(0, addr_x2, start, 16); // This writes your_data to the global 

variable a.
var val_x2=debugSession.memory.readWord(0,addr_x2);
print("Value of x2",val_x2); 

// Run the target
debugSession.target.run();
print("Running");

var addr_m=debugSession.symbol.getAddress("m");
print("Address of variable m ",addr_m);
var val_m=debugSession.memory.readWord(0,addr_m); 
print("value of m is ", val_m);

var addr_c=debugSession.symbol.getAddress("c");
print("Address of variable c ",addr_c);
var val_c=debugSession.memory.readWord(0,addr_c); 
print("value of c is ", val_c);


var ret=mytestfunc(val_x1 ,val_x2);


TEST_ASSERT_INT(ret,val_c);
start=start+1;
print("INside loop",start);
debugSession.target.restart();
print("Running");

}

// All done
//debugServer.stop();

script.traceWrite("End scripting session");

// Stop logging and exit.
script.traceEnd();

function mytestfunc(x,y)
{
return x+y;
}

function TEST_ASSERT_INT(A,B)
{
if(A==B)
{
print("TEST PASSED");
}
else
print("TEST FAILED");
}

This works good as a starting point .. I want now the Test Scripts to support Object Oriented  Approach which is creating few problems . For example

public class Test 
{ 
	// Instance Variables 
	
	var a; 
	var b; 

	// Constructor Declaration of Class 
	public Test(int a, int b) 
	{ 
		this.a = a; 
		this.b = b; 
	 
	}
      public geta() 
      {
       return a;
      }
      public getb() 
      {
       return b;
      }

}

But this throws me error like 

"identifier is a reserved word"

at the place where class Test is defined