I am writing a parser which generates the 32 bit opcode for each command. For example, for the following statement:

set lcl_var = 2

my parser generates the following opcodes:

// load immdshort 2 (loads the value 2)
0x10000010
// strlocal lclvar (lcl_var is converted to an index to identify the var)
0x01000002

Please note that lcl_var can be anything i.e., any variable can be given. How can I write the unit test cases for this? Can we avoid hard coding the values? Is there a way to make it generic?

Edit
Report