Blame external/pybind11/tests/test_union.cpp
|
Packit |
534379 |
/*
|
|
Packit |
534379 |
tests/test_class.cpp -- test py::class_ definitions and basic functionality
|
|
Packit |
534379 |
|
|
Packit |
534379 |
Copyright (c) 2019 Roland Dreier <roland.dreier@gmail.com>
|
|
Packit |
534379 |
|
|
Packit |
534379 |
All rights reserved. Use of this source code is governed by a
|
|
Packit |
534379 |
BSD-style license that can be found in the LICENSE file.
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#include "pybind11_tests.h"
|
|
Packit |
534379 |
|
|
Packit |
534379 |
TEST_SUBMODULE(union_, m) {
|
|
Packit |
534379 |
union TestUnion {
|
|
Packit |
534379 |
int value_int;
|
|
Packit |
534379 |
unsigned value_uint;
|
|
Packit |
534379 |
};
|
|
Packit |
534379 |
|
|
Packit |
534379 |
py::class_<TestUnion>(m, "TestUnion")
|
|
Packit |
534379 |
.def(py::init<>())
|
|
Packit |
534379 |
.def_readonly("as_int", &TestUnion::value_int)
|
|
Packit |
534379 |
.def_readwrite("as_uint", &TestUnion::value_uint);
|
|
Packit |
534379 |
}
|