runtime_test.go 919 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. package wamr
  6. import (
  7. "github.com/stretchr/testify/assert"
  8. "testing"
  9. )
  10. func TestRuntime(t *testing.T) {
  11. res := false
  12. if (Runtime() != nil) {
  13. res = true;
  14. }
  15. assert.Equal(t, res, true)
  16. err := Runtime().Init()
  17. assert.NoError(t, err)
  18. Runtime().Destroy()
  19. err = Runtime().FullInit(false, nil, 6)
  20. assert.NoError(t, err)
  21. Runtime().Destroy()
  22. err = Runtime().FullInit(false, nil, 0)
  23. assert.NoError(t, err)
  24. Runtime().Destroy()
  25. heap_buf := make([]byte, 128 * 1024)
  26. err = Runtime().FullInit(true, heap_buf, 4)
  27. assert.NoError(t, err)
  28. Runtime().Destroy()
  29. Runtime().FullInit(false, nil, 0)
  30. err = Runtime().FullInit(false, nil, 0)
  31. assert.NoError(t, err)
  32. Runtime().Destroy()
  33. Runtime().Destroy()
  34. }