test_chrono.cpp (11986:c12e4625ab56) test_chrono.cpp (12037:d28054ac6ec9)
1/*
2 tests/test_chrono.cpp -- test conversions to/from std::chrono types
3
4 Copyright (c) 2016 Trent Houliston <trent@houliston.me> and
5 Wenzel Jakob <wenzel.jakob@epfl.ch>
6
7 All rights reserved. Use of this source code is governed by a
8 BSD-style license that can be found in the LICENSE file.

--- 34 unchanged lines hidden (view full) ---

43 return t;
44}
45
46// Roundtrip a duration in microseconds from a float argument
47std::chrono::microseconds test_chrono7(std::chrono::microseconds t) {
48 return t;
49}
50
1/*
2 tests/test_chrono.cpp -- test conversions to/from std::chrono types
3
4 Copyright (c) 2016 Trent Houliston <trent@houliston.me> and
5 Wenzel Jakob <wenzel.jakob@epfl.ch>
6
7 All rights reserved. Use of this source code is governed by a
8 BSD-style license that can be found in the LICENSE file.

--- 34 unchanged lines hidden (view full) ---

43 return t;
44}
45
46// Roundtrip a duration in microseconds from a float argument
47std::chrono::microseconds test_chrono7(std::chrono::microseconds t) {
48 return t;
49}
50
51// Float durations (issue #719)
52std::chrono::duration<double> test_chrono_float_diff(std::chrono::duration<float> a, std::chrono::duration<float> b) {
53 return a - b;
54}
55
51test_initializer chrono([] (py::module &m) {
52 m.def("test_chrono1", &test_chrono1);
53 m.def("test_chrono2", &test_chrono2);
54 m.def("test_chrono3", &test_chrono3);
55 m.def("test_chrono4", &test_chrono4);
56 m.def("test_chrono5", &test_chrono5);
57 m.def("test_chrono6", &test_chrono6);
58 m.def("test_chrono7", &test_chrono7);
56test_initializer chrono([] (py::module &m) {
57 m.def("test_chrono1", &test_chrono1);
58 m.def("test_chrono2", &test_chrono2);
59 m.def("test_chrono3", &test_chrono3);
60 m.def("test_chrono4", &test_chrono4);
61 m.def("test_chrono5", &test_chrono5);
62 m.def("test_chrono6", &test_chrono6);
63 m.def("test_chrono7", &test_chrono7);
64 m.def("test_chrono_float_diff", &test_chrono_float_diff);
59});
65});