4684ddb6aa
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
29 lines
409 B
C++
29 lines
409 B
C++
#include <stdio.h>
|
|
#include "test.h"
|
|
|
|
static int static_count;
|
|
struct static_struct
|
|
{
|
|
int i;
|
|
static_struct()
|
|
{
|
|
static_count++;
|
|
i = 12;
|
|
};
|
|
};
|
|
|
|
static static_struct ss;
|
|
|
|
int init_static(void)
|
|
{
|
|
static static_struct s;
|
|
return s.i;
|
|
}
|
|
|
|
void test_guards(void)
|
|
{
|
|
init_static();
|
|
int i = init_static();
|
|
TEST(i == 12, "Static initialized");
|
|
TEST(static_count == 2, "Each static only initialized once");
|
|
}
|