Permalink
Browse files

Merge pull request #71 from Turupawn/devel

New mod installation process changes, unit test setup and code cleanup
  • Loading branch information...
Turupawn committed Nov 8, 2018
2 parents 27759cb + 6976388 commit 637e91dc7dbd756aec3becebe36353207b43c2c4
Showing 418 changed files with 154,542 additions and 685 deletions.
View
@@ -17,5 +17,7 @@ addons:
script:
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then CXX=/usr/bin/g++-5 CC=/usr/bin/gcc-5 cmake . ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake . ; fi
- cmake --build . -- -j2
- cmake -Dtest=on .
- make -j2
- make test
- ls
View
@@ -12,6 +12,7 @@ file(GLOB_RECURSE SOURCES "src/*.cpp")
if( mode AND mode STREQUAL "static" )
message("Building mod.io SDK statically")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-DMODIO_STATICLIB -DCURL_STATICLIB)
add_library(modio STATIC ${SOURCES})
else()
@@ -48,3 +49,14 @@ IF (MSVC)
target_link_libraries(modio ws2_32.lib wldap32.lib advapi32.lib kernel32.lib comdlg32.lib crypt32.lib normaliz.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/libcurl_a.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/zlib.lib )
endif()
ENDIF()
IF( test AND test STREQUAL "on" )
message("Testing enabled")
file(GLOB TEST_SRC_FILES ${PROJECT_SOURCE_DIR}/test/*.cpp)
add_subdirectory(ext/gtest-1.8.0)
enable_testing()
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(runUnitTests ${TEST_SRC_FILES})
target_link_libraries(runUnitTests gtest gtest_main modio)
add_test(UnitTests runUnitTests)
ENDIF()
@@ -33,15 +33,17 @@ int main(void)
std::cout << "Enter the mod id: " << std::endl;
std::cin >> mod_id;
std::cout << "Installing mod..." << std::endl;
std::cout << "Downloading mod..." << std::endl;
modio_instance.installMod(mod_id);
modio_instance.downloadMod(mod_id);
modio_instance.setDownloadListener([&](u32 response_code, u32 mod_id) {
std::cout << "Install mod response: " << response_code << std::endl;
std::cout << "Download mod response: " << response_code << std::endl;
if (response_code == 200)
{
std::cout << "Mod " << mod_id << " installed successfully" << std::endl;
std::cout << "Mod " << mod_id << " downloaded successfully" << std::endl;
std::cout << "Installing downloaded mods" << std::endl;
modio_instance.installDownloadedMods();
}
finish();
@@ -13,21 +13,23 @@ int main(void)
// In this example we are going to queue two mods downloads.
u32 mod_id;
std::cout << "Enter a mod id to install: " << std::endl;
std::cout << "Enter a mod id to download: " << std::endl;
std::cin >> mod_id;
modio_instance.installMod(mod_id);
modio_instance.downloadMod(mod_id);
std::cout << "Enter another mod id to install: " << std::endl;
std::cout << "Enter another mod id to download: " << std::endl;
std::cin >> mod_id;
modio_instance.installMod(mod_id);
modio_instance.downloadMod(mod_id);
std::cout << "Installing mods..." << std::endl;
std::cout << "Downloading mods..." << std::endl;
modio_instance.setDownloadListener([&](u32 response_code, u32 mod_id) {
std::cout << "Install mod response: " << response_code << std::endl;
std::cout << "Download mod response: " << response_code << std::endl;
if (response_code == 200)
{
std::cout << "Mod " << mod_id << " installed successfully" << std::endl;
std::cout << "Mod " << mod_id << " download successfully" << std::endl;
std::cout << "Installing downloaded mods" << std::endl;
modio_instance.installDownloadedMods();
}
if (modio_instance.getModDownloadQueue().size() == 0)
finish();
View
Binary file not shown.
@@ -2,12 +2,15 @@
bool wait = true;
void onInstallMod(u32 response_code, u32 mod_id)
void onDownloadMod(u32 response_code, u32 mod_id)
{
printf("Install mod response: %i\n", response_code);
printf("Download mod response: %i\n", response_code);
if (response_code == 200)
{
printf("Mod installed successfully!\n");
printf("Mod downloaded successfully!\n");
printf("Installing mods...\n");
modioInstallDownloadedMods();
printf("Finished installing mods\n");
}
wait = false;
}
@@ -21,12 +24,12 @@ int main(void)
u32 mod_id;
scanf("%i", &mod_id);
printf("Installing modfile...\n");
printf("Downloading modfile...\n");
// In order to know when a mod has been downloaded we can register a function as a listener
modioSetDownloadListener(&onInstallMod);
modioSetDownloadListener(&onDownloadMod);
// To download the mod we only have to provide it's id
modioInstallMod(mod_id);
modioDownloadMod(mod_id);
while (wait)
{
@@ -2,12 +2,12 @@
bool finish = false;
void onModInstalled(u32 response_code, u32 mod_id)
void onModDownloaded(u32 response_code, u32 mod_id)
{
printf("Install Mod response: %i\n", response_code);
printf("Downloaded Mod response: %i\n", response_code);
if (response_code == 200)
{
printf("Mod %i installed successfully!\n", mod_id);
printf("Mod %i downloaded successfully!\n", mod_id);
}
if (modioGetModDownloadQueueCount() == 0)
@@ -22,17 +22,17 @@ int main(void)
// In this example we are going to queue two mods downloads.
u32 mod_id;
printf("Enter a mod id to install: \n");
printf("Enter a mod id to download: \n");
scanf("%i", &mod_id);
modioInstallMod(mod_id);
modioDownloadMod(mod_id);
printf("Enter another mod id to install: \n");
printf("Enter another mod id to download: \n");
scanf("%i", &mod_id);
modioInstallMod(mod_id);
modioDownloadMod(mod_id);
printf("Installing mods...\n");
printf("Downloading mods...\n");
modioSetDownloadListener(&onModInstalled);
modioSetDownloadListener(&onModDownloaded);
while (!finish)
{
@@ -81,11 +81,10 @@ typedef int i32;
#define MODIO_MOD_DOWNLOADING 4
#define MODIO_MOD_PAUSING 5
#define MODIO_MOD_PAUSED 6
#define MODIO_MOD_EXTRACTING 7
#define MODIO_MOD_INSTALLED 8
#define MODIO_PRIORITIZING_OTHER_DOWNLOAD 9
#define MODIO_MOD_STARTING_UPLOAD 10
#define MODIO_MOD_UPLOADING 11
#define MODIO_MOD_INSTALLED 7
#define MODIO_PRIORITIZING_OTHER_DOWNLOAD 8
#define MODIO_MOD_STARTING_UPLOAD 9
#define MODIO_MOD_UPLOADING 10
// Maturity options
#define MODIO_MATURITY_NONE 0
@@ -614,7 +613,8 @@ void modioSetAutomaticUpdatesConfig(u32 option);
void modioSetAllowBackgroundDownloadsConfig(u32 option);
//Downloads Methods
void modioInstallMod(u32 mod_id);
void modioDownloadMod(u32 mod_id);
void modioInstallDownloadedMods();
bool modioUninstallMod(u32 mod_id);
void modioPauseDownloads();
void modioResumeDownloads();
View
No changes.
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 2.6.2)
project( googletest-distribution )
enable_testing()
option(BUILD_GTEST "Builds the googletest subproject" OFF)
#Note that googlemock target already builds googletest
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
if(BUILD_GMOCK)
add_subdirectory( googlemock )
elseif(BUILD_GTEST)
add_subdirectory( googletest )
endif()
View
@@ -0,0 +1,142 @@
# Google Test #
[![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest)
[![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/BillyDonahue/googletest/branch/master)
Welcome to **Google Test**, Google's C++ test framework!
This repository is a merger of the formerly separate GoogleTest and
GoogleMock projects. These were so closely related that it makes sense to
maintain and release them together.
Please see the project page above for more information as well as the
mailing list for questions, discussions, and development. There is
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
join us!
Getting started information for **Google Test** is available in the
[Google Test Primer](googletest/docs/Primer.md) documentation.
**Google Mock** is an extension to Google Test for writing and using C++ mock
classes. See the separate [Google Mock documentation](googlemock/README.md).
More detailed documentation for googletest (including build instructions) are
in its interior [googletest/README.md](googletest/README.md) file.
## Features ##
* An [XUnit](https://en.wikipedia.org/wiki/XUnit) test framework.
* Test discovery.
* A rich set of assertions.
* User-defined assertions.
* Death tests.
* Fatal and non-fatal failures.
* Value-parameterized tests.
* Type-parameterized tests.
* Various options for running the tests.
* XML test report generation.
## Platforms ##
Google test has been used on a variety of platforms:
* Linux
* Mac OS X
* Windows
* Cygwin
* MinGW
* Windows Mobile
* Symbian
## Who Is Using Google Test? ##
In addition to many internal projects at Google, Google Test is also used by
the following notable projects:
* The [Chromium projects](http://www.chromium.org/) (behind the Chrome
browser and Chrome OS).
* The [LLVM](http://llvm.org/) compiler.
* [Protocol Buffers](https://github.com/google/protobuf), Google's data
interchange format.
* The [OpenCV](http://opencv.org/) computer vision library.
## Related Open Source Projects ##
[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs
your test binary, allows you to track its progress via a progress bar, and
displays a list of test failures. Clicking on one shows failure text. Google
Test UI is written in C#.
[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event
listener for Google Test that implements the
[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
result output. If your test runner understands TAP, you may find it useful.
## Requirements ##
Google Test is designed to have fairly minimal requirements to build
and use with your projects, but there are some. Currently, we support
Linux, Windows, Mac OS X, and Cygwin. We will also make our best
effort to support other platforms (e.g. Solaris, AIX, and z/OS).
However, since core members of the Google Test project have no access
to these platforms, Google Test may have outstanding issues there. If
you notice any problems on your platform, please notify
<googletestframework@googlegroups.com>. Patches for fixing them are
even more welcome!
### Linux Requirements ###
These are the base requirements to build and use Google Test from a source
package (as described below):
* GNU-compatible Make or gmake
* POSIX-standard shell
* POSIX(-2) Regular Expressions (regex.h)
* A C++98-standard-compliant compiler
### Windows Requirements ###
* Microsoft Visual C++ v7.1 or newer
### Cygwin Requirements ###
* Cygwin v1.5.25-14 or newer
### Mac OS X Requirements ###
* Mac OS X v10.4 Tiger or newer
* Xcode Developer Tools
### Requirements for Contributors ###
We welcome patches. If you plan to contribute a patch, you need to
build Google Test and its own tests from a git checkout (described
below), which has further requirements:
* [Python](https://www.python.org/) v2.3 or newer (for running some of
the tests and re-generating certain source files from templates)
* [CMake](https://cmake.org/) v2.6.4 or newer
## Regenerating Source Files ##
Some of Google Test's source files are generated from templates (not
in the C++ sense) using a script.
For example, the
file include/gtest/internal/gtest-type-util.h.pump is used to generate
gtest-type-util.h in the same directory.
You don't need to worry about regenerating the source files
unless you need to modify them. You would then modify the
corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)'
generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
### Contributing Code ###
We welcome patches. Please read the
[Developer's Guide](googletest/docs/DevGuide.md)
for how you can contribute. In particular, make sure you have signed
the Contributor License Agreement, or we won't be able to accept the
patch.
Happy testing!
Oops, something went wrong.

0 comments on commit 637e91d

Please sign in to comment.