-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Begin test coverage #167
Comments
Having some real trouble with this; the Module structs are fine, since they do nothing particular in their deconstructors. The Widgets and ModuleWidgets however, are loaded with When attempting to construct/deconstruct instances naively ( The same thing happens when using shared pointers? I'd prefer to be using:
I am blocked a bit by hesitance; I don't fully understand the "quirks" about held resources and Rack For DAW's... So, the design system deep-dive shall take precedence, before I can create satisfactory unit tests on this. |
I suppose we could always test to make sure that it fails with a SIGABRT :) |
I've had a clue about getting a test fixture working - it turns out, Rack's It's a pretty hefty entry point; instead of abstracting the startup routine into their own I need to create some kind of local, altered copy of this file which starts Catch2 on-demand within Rack's |
Cool - I just literally copied # Standalone adapter
STANDALONE_SOURCES += test/Adapter.cpp
ifdef ARCH_LIN
STANDALONE_TARGET := Rack
STANDALONE_LDFLAGS += -static-libstdc++ -static-libgcc
STANDALONE_LDFLAGS += -Wl,-rpath=.
STANDALONE_LIB := libRack.so
endif
ifdef ARCH_MAC
STANDALONE_TARGET := Rack
STANDALONE_LDFLAGS += -stdlib=libc++
STANDALONE_LIB := libRack.dylib
endif
ifdef ARCH_WIN
STANDALONE_TARGET := Rack.exe
STANDALONE_LDFLAGS += -mwindows
# 1MiB stack size to match MSVC
STANDALONE_LDFLAGS += -Wl,--stack,0x100000
STANDALONE_OBJECTS += build/Rack.res
STANDALONE_LIB := libRack.dll
endif
STANDALONE_OBJECTS += $(PWD)/build/vcpkg_installed/$(TRIPLET_ARCH)-$(TRIPLET_OS)/lib/$(STANDALONE_LIB)
$(STANDALONE_TARGET): $(STANDALONE_SOURCES) $(STANDALONE_OBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(STANDALONE_LDFLAGS) I just did I'll make some space for a new, improved test executable. The additional cool thing about this: when building this executable with ::std::unordered_map<void*, size_t> allocationMap;
void* operator new(size_t size)
{
void* ptr = ::std::malloc(size);
allocationMap[ptr] = size;
return ptr;
}
void operator delete(void* ptr) noexcept
{
allocationMap.erase(ptr);
::std::free(ptr);
} When the program goes into it's shutdown mode, before exiting int main()
{
// run Rack...
// ..before closing:
if (!allocationMap.empty())
{
DEBUG("Memory leaks detected:"); // use Rack's DEBUG macro and underlying rack::logger...
for (const auto& pair : allocationMap) {
DEBUG("Leaked address: %s", ::std::string(pair.first).c_str());
DEBUG("Leak size: %s", ::std::string(pair.second).c_str());
}
} else {
DEBUG("No memory leaks detected.");
}
return; // as usual...
} |
REQUIRE_THAT(box.size.x, WithinRel(::rack::mm2px(5.08F)))
, etc... #327box.size.y == ...
as above #328The text was updated successfully, but these errors were encountered: