Opened 16 years ago
Closed 15 years ago
#847 closed Support Requests (fixed)
[Test Library] How to init/free a singleton
| Reported by: | everguet | Owned by: | Gennadiy Rozental |
|---|---|---|---|
| Milestone: | Component: | test | |
| Version: | None | Severity: | Problem |
| Keywords: | Cc: |
Description
Hi, Where is the good place to initialize / free a singleton in an unit test suite ? If a add my singleton GetInstante() in the beginning of init_unit_test_suite(), and my FreeInstance() in the end of the method, they are called before executing test cases. Do I have to add a first test case, which will get my singleton, and a final test case to free it, or is there another way to do it properly ? Thanks.
Change History (6)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Logged In: YES user_id=383098 Originator: YES Where is it defined ? No trace of this macro in Boost v1.33.1. Thanks.
comment:3 by , 16 years ago
| Status: | assigned → closed |
|---|
comment:4 by , 16 years ago
Logged In: YES user_id=331868 Originator: NO It's defined in 1.34.0 RC. 1.34.0 should be out soon
comment:5 by , 15 years ago
| Component: | None → test |
|---|---|
| Severity: | → Problem |
Note:
See TracTickets
for help on using tickets.

Logged In: YES user_id=331868 Originator: NO The good place to init/release singleton would be a global fixture: struct MyConfig { MyConfig() { // do init here } ~MyConfig() { // do release here } } BOOST_GLOBAL_FIXTURE( MyConfig );