mirror of https://github.com/status-im/xgo.git
Add some sample test codes to allow unit testing.
This commit is contained in:
parent
b27e6e194e
commit
7be9c29ba2
|
@ -0,0 +1,17 @@
|
|||
// Go cross compiler (xgo): Test file for embedded C snippets.
|
||||
// Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
//
|
||||
// Released under the MIT license.
|
||||
|
||||
package main
|
||||
|
||||
// #include <stdio.h>
|
||||
//
|
||||
// void sayHi() {
|
||||
// printf("Hello, embedded C!\n");
|
||||
// }
|
||||
import "C"
|
||||
|
||||
func main() {
|
||||
C.sayHi()
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// Go cross compiler (xgo): Test file for embedded C++ snippets.
|
||||
// Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
//
|
||||
// Released under the MIT license.
|
||||
|
||||
package main
|
||||
|
||||
// #include "snippet.h"
|
||||
import "C"
|
||||
|
||||
func main() {
|
||||
C.sayHi()
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// Go cross compiler (xgo): Test implementation for embedded C++ snippets.
|
||||
// Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
//
|
||||
// Released under the MIT license.
|
||||
|
||||
#include <iostream>
|
||||
#include "snippet.h"
|
||||
|
||||
void sayHi() {
|
||||
std::cout << "Hello, embedded C++!" << std::endl;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
// Go cross compiler (xgo): Test header for embedded C++ snippets.
|
||||
// Copyright (c) 2015 Péter Szilágyi. All rights reserved.
|
||||
//
|
||||
// Released under the MIT license.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void sayHi();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue