@@ -126,9 +126,10 @@ describe('Assembly-BPF SDK', () => {
126126
127127 const result = await sdk . compile ( instructions , metadata ) ;
128128
129- // The current implementation doesn't validate opcodes, so this passes
130- // In a real implementation, this would fail
131- expect ( result . success ) . toBe ( true ) ;
129+ // Should now properly fail with enhanced validation
130+ expect ( result . success ) . toBe ( false ) ;
131+ expect ( result . errors ) . toBeDefined ( ) ;
132+ expect ( result . errors ! . length ) . toBeGreaterThan ( 0 ) ;
132133 } ) ;
133134 } ) ;
134135
@@ -209,14 +210,14 @@ describe('Assembly-BPF SDK', () => {
209210
210211 describe ( 'Program Validation' , ( ) => {
211212 it ( 'should validate empty bytecode' , async ( ) => {
212- const result = await sdk . validateProgram ( new Uint8Array ( 0 ) ) ;
213+ const result = await sdk . validateBytecode ( new Uint8Array ( 0 ) ) ;
213214 expect ( result . valid ) . toBe ( false ) ;
214215 expect ( result . issues ) . toContain ( 'Empty bytecode' ) ;
215216 } ) ;
216217
217218 it ( 'should validate large bytecode' , async ( ) => {
218219 const largeBytecode = new Uint8Array ( 2 * 1024 * 1024 ) ; // 2MB
219- const result = await sdk . validateProgram ( largeBytecode ) ;
220+ const result = await sdk . validateBytecode ( largeBytecode ) ;
220221 expect ( result . valid ) . toBe ( false ) ;
221222 expect ( result . issues ) . toContain ( 'Program size exceeds maximum limit' ) ;
222223 } ) ;
@@ -228,7 +229,7 @@ describe('Assembly-BPF SDK', () => {
228229 normalBytecode [ 2 ] = 0x4c ;
229230 normalBytecode [ 3 ] = 0x46 ;
230231
231- const result = await sdk . validateProgram ( normalBytecode ) ;
232+ const result = await sdk . validateBytecode ( normalBytecode ) ;
232233 expect ( result . valid ) . toBe ( true ) ;
233234 expect ( result . issues ) . toHaveLength ( 0 ) ;
234235 } ) ;
@@ -388,11 +389,11 @@ describe('BPF Memory Manager', () => {
388389 const memoryManager = sdk . getMemoryManager ( ) ;
389390
390391 const storeInstr = memoryManager . storeMemory ( BPFRegister . R1 , - 8 ) ;
391- expect ( storeInstr . opcode ) . toBe ( BPFInstruction . STORE ) ;
392+ expect ( storeInstr . opcode ) . toBe ( BPFInstruction . STORE_MEM ) ;
392393 expect ( storeInstr . offset ) . toBe ( - 8 ) ;
393394
394395 const loadInstr = memoryManager . loadMemory ( BPFRegister . R2 , - 8 ) ;
395- expect ( loadInstr . opcode ) . toBe ( BPFInstruction . LOAD ) ;
396+ expect ( loadInstr . opcode ) . toBe ( BPFInstruction . LOAD_MEM ) ;
396397 expect ( loadInstr . offset ) . toBe ( - 8 ) ;
397398 } ) ;
398399
0 commit comments