File: printing.cpp

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (44 lines) | stat: -rw-r--r-- 665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "print-test.h"

#include "wasm.h"

using namespace wasm;

using PrintingTest = PrintTest;

TEST_F(PrintingTest, Print) {
  auto moduleText = R"wasm(
    (module
      (func $a (result i32)
        (i32.const 10)
      )
      (func $b
        (drop
          (i32.const 20)
        )
      )
    )
  )wasm";

  Module wasm;
  parseWast(wasm, moduleText);

  {
    std::stringstream ss;
    ss << *wasm.getFunction("a");
    EXPECT_EQ(ss.str(), R"print((func $a (result i32)
 (i32.const 10)
)
)print");
  }
  {
    std::stringstream ss;
    ss << *wasm.getFunction("b");
    EXPECT_EQ(ss.str(), R"print((func $b
 (drop
  (i32.const 20)
 )
)
)print");
  }
}