-
Notifications
You must be signed in to change notification settings - Fork 195
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
Unit tests #362
base: master
Are you sure you want to change the base?
Unit tests #362
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,48 @@ | |
#include "Testing/BsConsoleTestOutput.h" | ||
#include "Private/UnitTests/BsUtilityTestSuite.h" | ||
|
||
#include "BsApplication.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally I organize the non-plugin code in layers. 'Utility' layer is the lowest one, and it shouldn't be referencing anything from the higher layers (this includes Application or CoreApplication). Are these tests failing without the Application started up? Ideally we can run them without it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm. well we could just change it to BsCoreApplication, which is the core layer, and therefore compatible with all other layers of testing for most part. I'll make the change and see if that works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope nvm, CoreApplication can't be initialized by itself for running the utility tests. stuff like gProfiler still gets called |
||
#include "BsEngineConfig.h" | ||
|
||
using namespace bs; | ||
|
||
|
||
START_UP_DESC testStartupDesc() | ||
{ | ||
START_UP_DESC desc; | ||
|
||
// Set up default plugins | ||
desc.renderAPI = BS_RENDER_API_MODULE; | ||
// desc.renderAPI = "NullRenderAPI" | ||
desc.renderer = BS_RENDERER_MODULE; | ||
// desc.renderer = "NullRenderer"; | ||
desc.audio = BS_AUDIO_MODULE; | ||
desc.physics = BS_PHYSICS_MODULE; | ||
|
||
desc.importers.push_back("bsfFreeImgImporter"); | ||
desc.importers.push_back("bsfFBXImporter"); | ||
desc.importers.push_back("bsfFontImporter"); | ||
desc.importers.push_back("bsfSL"); | ||
|
||
VideoMode mode; | ||
desc.primaryWindowDesc.videoMode = mode; | ||
desc.primaryWindowDesc.fullscreen = false; | ||
desc.primaryWindowDesc.title = "test"; | ||
return desc; | ||
} | ||
|
||
int main() | ||
{ | ||
|
||
auto desc = testStartupDesc(); | ||
bs::Application::startUp(desc); | ||
|
||
SPtr<TestSuite> tests = UtilityTestSuite::create<UtilityTestSuite>(); | ||
|
||
ConsoleTestOutput testOutput; | ||
tests->run(testOutput); | ||
|
||
bs::Application::shutDown(); | ||
|
||
return 0; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "./BsBitstream.h" | ||
|
||
namespace bs | ||
{ | ||
uint32_t Bitstream::BYTES_PER_QUANT = sizeof(QuantType); | ||
uint32_t Bitstream::BITS_PER_QUANT = BYTES_PER_QUANT * 8; | ||
uint32_t Bitstream::BITS_PER_QUANT_LOG2 = Bitwise::bitsLog2(BITS_PER_QUANT); | ||
} // namespace bs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this macro vs. using
add_test
? Also, I'm seeing references toDebug
andRelease
- does it work on other configs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i updated with commit for explanation. Esentially I was getting "found .so library" errors until I updated the tests. plus it's just useful to have add_test wrapper for future in case there's other common properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't know if it works for other configs. But it at least works for my needs at the moment.