mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-30 21:02:27 +00:00 
			
		
		
		
	 5b1dcf2fa2
			
		
	
	
		5b1dcf2fa2
		
			
		
	
	
	
	
		
			
			Implement Go binding APIs of runtime, module and instance Add sample, build scripts and update the document Co-authored-by: venus-taibai <97893654+venus-taibai@users.noreply.github.com>
		
			
				
	
	
		
			43 lines
		
	
	
		
			919 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			919 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| /*
 | |
|  * Copyright (C) 2019 Intel Corporation.  All rights reserved.
 | |
|  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 | |
|  */
 | |
| 
 | |
| package wamr
 | |
| 
 | |
| import (
 | |
|     "github.com/stretchr/testify/assert"
 | |
|     "testing"
 | |
| )
 | |
| 
 | |
| func TestRuntime(t *testing.T) {
 | |
|     res := false
 | |
|     if (Runtime() != nil) {
 | |
|         res = true;
 | |
|     }
 | |
|     assert.Equal(t, res, true)
 | |
| 
 | |
|     err := Runtime().Init()
 | |
|     assert.NoError(t, err)
 | |
|     Runtime().Destroy()
 | |
| 
 | |
|     err = Runtime().FullInit(false, nil, 6)
 | |
|     assert.NoError(t, err)
 | |
|     Runtime().Destroy()
 | |
| 
 | |
|     err = Runtime().FullInit(false, nil, 0)
 | |
|     assert.NoError(t, err)
 | |
|     Runtime().Destroy()
 | |
| 
 | |
|     heap_buf := make([]byte, 128 * 1024)
 | |
|     err = Runtime().FullInit(true, heap_buf, 4)
 | |
|     assert.NoError(t, err)
 | |
|     Runtime().Destroy()
 | |
| 
 | |
|     Runtime().FullInit(false, nil, 0)
 | |
|     err = Runtime().FullInit(false, nil, 0)
 | |
|     assert.NoError(t, err)
 | |
|     Runtime().Destroy()
 | |
|     Runtime().Destroy()
 | |
| }
 |