1 // Copyright 2019 The Android Open Source Project
2 //
3 // This software is licensed under the terms of the GNU General Public
4 // License version 2, as published by the Free Software Foundation, and
5 // may be copied, distributed, and modified under those terms.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 // GNU General Public License for more details.
11 #include <gtest/gtest.h>
12 
13 static int said_hello = 0;
14 const char* msg = "Hello world";
15 
16 extern "C" {
17 extern int say_hello();
18 
hello(int x,char * str)19 void hello(int x, char *str) {
20     said_hello = 1;
21     EXPECT_EQ(x, 127);
22     EXPECT_STREQ(str, "Hello world");
23 }
24 }
25 
TEST(Yasm,SayHelloFromAsm)26 TEST(Yasm, SayHelloFromAsm) {
27     EXPECT_EQ(say_hello(), 0xFF);
28     EXPECT_EQ(said_hello, 1);
29 }
30