diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 372c0955..e0e72db2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,159 +42,155 @@ jobs: unreal: true steps: + # Checkout project + - uses: actions/checkout@v6 + with: + submodules: true - # Checkout project - - uses: actions/checkout@v6 - with: - submodules: true - - # Setup python - - uses: actions/setup-python@v5 - if: ${{ matrix.proof }} - with: - python-version: '3.x' + # Setup python + - uses: actions/setup-python@v5 + if: ${{ matrix.proof }} + with: + python-version: "3.x" - # Setup CMake - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 - with: - cmake-version: '3.22.x' + # Setup CMake + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: "3.22.x" - # Create a build directory to store all the CMake generated files - - name: Create Build Environment - run: cmake -E make_directory ${{github.workspace}}/build + # Setup Ninja + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@v1.1 + with: + version: 1.13.0 + # Create a build directory to store all the CMake generated files + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build - # Run CMake configuration to create build files - - name: Configure CMake - shell: bash - working-directory: ${{github.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINKCPP_PY=OFF -DINKCPP_C=ON -DINKCPP_TEST=ON -DINKCPP_INKLECATE=OS + # Run CMake configuration to create build files + - name: Configure CMake + working-directory: ${{github.workspace}}/build + # execute this in the native schell to get a native executable file + run: cmake ${{github.workspace}} -GNinja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE}} -DINKCPP_PY=OFF -DINKCPP_C=ON -DINKCPP_TEST=ON -DINKCPP_INKLECATE=OS - # Build using CMake and OS toolkit - - name: Build - working-directory: ${{github.workspace}}/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + # Build using CMake and OS toolkit + - name: Build + working-directory: ${{github.workspace}}/build + # execute this in the native schell to get a native executable file + run: cmake --build . --config ${{env.BUILD_TYPE}} + # Run CMake tests (unit tests, etc.) + - name: CTests + working-directory: ${{github.workspace}}/build + run: ctest . -C ${{env.BUILD_TYPE}} -V - # Run CMake tests (unit tests, etc.) - - name: CTests - working-directory: ${{github.workspace}}/build - shell: bash - run: ctest . -C $BUILD_TYPE -V + # Copy all build artifacts to the bin directory + - name: Install Cl + working-directory: ${{github.workspace}}/build + run: cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_cl --component cl + - name: Upload Cl + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.artifact }}-cl + path: build/comp_cl/ - # Copy all build artifacts to the bin directory - - name: Install Cl - working-directory: ${{github.workspace}}/build - shell: bash - run: cmake --install . --config $BUILD_TYPE --prefix comp_cl --component cl - - name: Upload Cl - uses: actions/upload-artifact@v7 - with: - name: ${{ matrix.artifact }}-cl - path: build/comp_cl/ + - name: Install Lib + working-directory: ${{github.workspace}}/build + run: cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_lib --component lib + - name: Upload Lib + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.artifact }}-lib + path: build/comp_lib/ - - name: Install Lib - working-directory: ${{github.workspace}}/build - shell: bash - run: cmake --install . --config $BUILD_TYPE --prefix comp_lib --component lib - - name: Upload Lib - uses: actions/upload-artifact@v7 - with: - name: ${{ matrix.artifact }}-lib - path: build/comp_lib/ + - name: Install CLib + working-directory: ${{github.workspace}}/build + run: cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_clib --component clib + - name: Upload Clib + uses: actions/upload-artifact@v7 + with: + name: ${{matrix.artifact}}-clib + path: build/comp_clib - - name: Install CLib - working-directory: ${{github.workspace}}/build - shell: bash - run: cmake --install . --config $BUILD_TYPE --prefix comp_clib --component clib - - name: Upload Clib - uses: actions/upload-artifact@v7 - with: - name: ${{matrix.artifact}}-clib - path: build/comp_clib + - name: Install UE + if: ${{ matrix.unreal }} + working-directory: ${{github.workspace}}/build + run: | + cmake ${{github.workspace}} -DINKCPP_UNREAL_TARGET_VERSION="5.7" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE + cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_unreal_5_7 --component unreal + cmake ${{github.workspace}} -DINKCPP_UNREAL_TARGET_VERSION="5.6" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE + cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_unreal_5_6 --component unreal + cmake ${{github.workspace}} -DINKCPP_UNREAL_TARGET_VERSION="5.5" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE + cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_unreal_5_5 --component unreal + cmake ${{github.workspace}} -DINKCPP_UNREAL_TARGET_VERSION="5.4" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE + cmake --install . --config ${{env.BUILD_TYPE}} --prefix comp_unreal_5_4 --component unreal + - name: Upload UE 5.7 + if: ${{ matrix.unreal }} + uses: actions/upload-artifact@v7 + with: + name: unreal_5_7 + path: build/comp_unreal_5_7/ + - name: Upload UE 5.6 + if: ${{ matrix.unreal }} + uses: actions/upload-artifact@v7 + with: + name: unreal_5_6 + path: build/comp_unreal_5_6/ + - name: Upload UE 5.5 + if: ${{ matrix.unreal }} + uses: actions/upload-artifact@v7 + with: + name: unreal_5_5 + path: build/comp_unreal_5_5/ + - name: Upload UE 5.4 + if: ${{ matrix.unreal }} + uses: actions/upload-artifact@v7 + with: + name: unreal_5_4 + path: build/comp_unreal_5_4/ - - name: Install UE - if: ${{ matrix.unreal }} - working-directory: ${{github.workspace}}/build - shell: bash - run: | - cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.7" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE - cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_7 --component unreal - cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.6" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE - cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_6 --component unreal - cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.5" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE - cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_5 --component unreal - cmake $GITHUB_WORKSPACE -DINKCPP_UNREAL_TARGET_VERSION="5.4" -DINKCPP_UNREAL=ON -DINKCPP_INKLECATE=NONE - cmake --install . --config $BUILD_TYPE --prefix comp_unreal_5_4 --component unreal - - name: Upload UE 5.7 - if: ${{ matrix.unreal }} - uses: actions/upload-artifact@v7 - with: - name: unreal_5_7 - path: build/comp_unreal_5_7/ - - name: Upload UE 5.6 - if: ${{ matrix.unreal }} - uses: actions/upload-artifact@v7 - with: - name: unreal_5_6 - path: build/comp_unreal_5_6/ - - name: Upload UE 5.5 - if: ${{ matrix.unreal }} - uses: actions/upload-artifact@v7 - with: - name: unreal_5_5 - path: build/comp_unreal_5_5/ - - name: Upload UE 5.4 - if: ${{ matrix.unreal }} - uses: actions/upload-artifact@v7 - with: - name: unreal_5_4 - path: build/comp_unreal_5_4/ + # Make sure Inkproof has everything it needs to run our executable + - name: Setup Ink Proof + if: ${{ matrix.proof }} + working-directory: proofing/ink-proof + run: | + git apply ../diff_py-codecs.patch + python3 install_deps.py + cp ../inkcpp_runtime_driver drivers/ + cmake -E make_directory deps/inkcpp + cp ../../build/comp_cl/* deps/inkcpp/ - # Make sure Inkproof has everything it needs to run our executable - - name: Setup Ink Proof - if: ${{ matrix.proof }} - shell: bash - working-directory: proofing/ink-proof - run: | - python3 install_deps.py - cp ../inkcpp_runtime_driver drivers/ - chmod +x drivers/inkcpp_runtime_driver - mkdir deps/inkcpp - cp ../../build/comp_cl/* deps/inkcpp/ - chmod +x deps/inkcpp/inkcpp_cl - # Run it - - name: Run Ink Proof - if: ${{ matrix.proof }} - shell: bash - working-directory: proofing/ink-proof - run: | - python3 proof.py --examples 'I...' inklecate_v1.1.1 inkcpp_runtime > run.out - echo -e "| ${{ matrix.name }} | $(cat run.out) |" > ${{ matrix.artifact }}.txt + # Run it + - name: Run Ink Proof + if: ${{ matrix.proof }} + working-directory: proofing/ink-proof + run: | + python3 proof.py --examples 'I...' inklecate_v1.1.1 inkcpp_runtime > run.out + cmake -E echo "| ${{ matrix.name }} | $(cat run.out) |" > ${{ matrix.artifact }}.txt - # Creates a "disabled" artifact if ink proofing is disabled - - name: Create Disabled InkProof Results File - if: ${{ !matrix.proof }} - shell: bash - run: | - mkdir -p proofing/ink-proof - echo "| ${{ matrix.name }} | DISABLED |" > proofing/ink-proof/${{ matrix.artifact }}.txt + # Creates a "disabled" artifact if ink proofing is disabled + - name: Create Disabled InkProof Results File + if: ${{ !matrix.proof }} + shell: bash + run: | + mkdir -p proofing/ink-proof + echo "| ${{ matrix.name }} | DISABLED |" > proofing/ink-proof/${{ matrix.artifact }}.txt - # Upload results artifact - - name: Upload Results Artifact - uses: actions/upload-artifact@v7 - with: - name: result-${{ matrix.artifact }} - path: proofing/ink-proof/${{ matrix.artifact }}.txt + # Upload results artifact + - name: Upload Results Artifact + uses: actions/upload-artifact@v7 + with: + name: result-${{ matrix.artifact }} + path: proofing/ink-proof/${{ matrix.artifact }}.txt - # Upload website artifact - - name: Upload Ink-Proof Website Artifact - if: ${{ matrix.proof }} - uses: actions/upload-artifact@v7 - with: - name: ${{ matrix.artifact }}-www - path: proofing/ink-proof/out + # Upload website artifact + - name: Upload Ink-Proof Website Artifact + if: ${{ matrix.proof }} + uses: actions/upload-artifact@v7 + with: + name: ${{ matrix.artifact }}-www + path: proofing/ink-proof/out build-doc: name: Build Doxygen documentation @@ -203,103 +199,101 @@ jobs: env: DOXYGEN_VERSION: "1.17.0" steps: - - uses: actions/checkout@v6 - with: - submodules: true - - name: Set upt Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: install pyton libs - run: >- - python3 -m - pip install - pybind11-stubgen - pdoc - --user - - uses: actions/cache@v5 - id: cache-doxygen - with: - path: doxygen-${{ env.DOXYGEN_VERSION }}.linux.bin.tar.gz - key: doxygen-${{ env.DOXYGEN_VERSION }} - - name: download Doxygen - if: steps.cache-doxygen.outputs.cache-hit != 'true' - run: wget https://www.doxygen.nl/files/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz - - name: Install Doxygen - run: | - sudo apt-get install graphviz -y - tar xzf doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz - cd doxygen-$DOXYGEN_VERSION/ - sudo make install - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 - with: - cmake-version: '3.22.x' - - name: Create Build Environment - run: cmake -E make_directory ${{github.workspace}}/build - - name: Configure CMake - shell: bash - working-directory: ${{github.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON - - name: Build - working-directory: ${{github.workspace}}/build - shell: bash - run: cmake --build . --target doc --config Release - - name: Upload - uses: actions/upload-artifact@v7 - with: - name: doxygen - path: Documentation/ + - uses: actions/checkout@v6 + with: + submodules: true + - name: Set upt Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: install pyton libs + run: >- + python3 -m + pip install + pybind11-stubgen + pdoc + --user + - uses: actions/cache@v5 + id: cache-doxygen + with: + path: doxygen-${{ env.DOXYGEN_VERSION }}.linux.bin.tar.gz + key: doxygen-${{ env.DOXYGEN_VERSION }} + - name: download Doxygen + if: steps.cache-doxygen.outputs.cache-hit != 'true' + run: wget https://www.doxygen.nl/files/doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz + - name: Install Doxygen + run: | + sudo apt-get install graphviz -y + tar xzf doxygen-$DOXYGEN_VERSION.linux.bin.tar.gz + cd doxygen-$DOXYGEN_VERSION/ + sudo make install + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: "3.22.x" + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + - name: Configure CMake + working-directory: ${{github.workspace}}/build + run: cmake ${{github.workspace}} -DCMAKE_BUILD_TYPE=Release -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON + - name: Build + working-directory: ${{github.workspace}}/build + run: cmake --build . --target doc --config Release + - name: Upload + uses: actions/upload-artifact@v7 + with: + name: doxygen + path: Documentation/ build-python: name: Build Python package needs: compilation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - with: - submodules: true - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: install build - run: >- - python3 -m - pip install - build - pybind11-stubgen - pdoc - pytest - --user - - name: Build python release - run: python3 -m build + - uses: actions/checkout@v6 + with: + submodules: true + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: install build + run: >- + python3 -m + pip install + build + pybind11-stubgen + pdoc + pytest + --user + - name: Build python release + run: python3 -m build - - uses: suisei-cn/actions-download-file@v1.6.0 - name: Download Inklecate - id: download_inklecate - with: - url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip - target: "inklecate/" - - name: Deploy Inkelcate - shell: bash - run: | - cd inklecate - unzip *.zip - echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV + - uses: suisei-cn/actions-download-file@v1.6.0 + name: Download Inklecate + id: download_inklecate + with: + url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip + target: "inklecate/" + - name: Deploy Inkelcate + shell: bash + run: | + cd inklecate + unzip *.zip + echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV - - name: Test python release - run: | - python3 -m pip install dist/*.whl --user - python3 -m pytest inkcpp_python/tests - - name: Remove wheel - run: | - rm dist/*.whl - - name: Upload Python files - uses: actions/upload-artifact@v7 - with: - name: python-package-distribution - path: dist/ + - name: Test python release + run: | + python3 -m pip install dist/*.whl --user + python3 -m pytest inkcpp_python/tests + - name: Remove wheel + run: | + rm dist/*.whl + - name: Upload Python files + uses: actions/upload-artifact@v7 + with: + name: python-package-distribution + path: dist/ clang-format: name: "Check Formatting" @@ -325,7 +319,7 @@ jobs: permissions: contents: write name: "Upload Ink-Proof to Github Pages" - needs: [ compilation, build-doc ] + needs: [compilation, build-doc] runs-on: ubuntu-latest if: github.ref == 'refs/heads/master' steps: diff --git a/inkcpp/include/functional.h b/inkcpp/include/functional.h index db354121..99309900 100644 --- a/inkcpp/include/functional.h +++ b/inkcpp/include/functional.h @@ -72,9 +72,13 @@ class callback final : public callback_base static_cast(type), static_cast(new_val.type) ); if constexpr (traits::arity == 2) { - // inkAssert(!old_val.has_value() || old_val.value().type == type, - // "Missmatch type for variable observers old value: expected optional<%i> got - // optional<%i>", static_cast(type), static_cast(old_val.value().type)); + if (old_val.has_value() && old_val.value().type != type) { + inkFail( + "Missmatch type for variable observers old value: expected optional<%i> got " + "optional<%i>", + static_cast(type), static_cast(old_val.value().type) + ); + } } }; if constexpr (traits::arity > 0) { diff --git a/inkcpp/include/globals.h b/inkcpp/include/globals.h index 4163ec24..649078f9 100644 --- a/inkcpp/include/globals.h +++ b/inkcpp/include/globals.h @@ -28,7 +28,7 @@ class globals_interface * @return nullopt if variable won't exist or type won't match */ template - optional get(const char* name) const + optional get(const char* /*name*/) const { static_assert(internal::always_false::value, "Requested Type is not supported"); } @@ -41,7 +41,7 @@ class globals_interface * @retval true on success */ template - bool set(const char* name, const T& val) + bool set(const char* /*name*/, const T& /*val*/) { static_assert(internal::always_false::value, "Requested Type is not supported"); return false; diff --git a/inkcpp/include/types.h b/inkcpp/include/types.h index e6cca05c..0610980f 100644 --- a/inkcpp/include/types.h +++ b/inkcpp/include/types.h @@ -129,6 +129,10 @@ struct value { /// @} +#ifdef __GNUCC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtautological-compare" +#endif /** Get value to corresponding type * @tparam Ty #Type label of type to get * @attention behavior if undefined if Ty != value.type @@ -138,6 +142,9 @@ struct value { { static_assert(Ty != Ty, "No value getter for the selected type"); } +#ifdef __GNUCC__ +# pragma GCC diagnostic pop +#endif }; /** access a @ref ink::runtime::value::Type::Bool value */ diff --git a/inkcpp/operations.h b/inkcpp/operations.h index 5bab700c..5b6b42f5 100644 --- a/inkcpp/operations.h +++ b/inkcpp/operations.h @@ -60,7 +60,7 @@ class operation static constexpr bool enabled = false; template - operation(const T& t) + operation(const T& /*t*/) { } @@ -69,7 +69,10 @@ class operation * @param stack were the result(s) get pushed * @param vs array of values, first one = first argument etc */ - void operator()(basic_eval_stack& stack, value* vs) { inkFail("operation not implemented!"); } + void operator()(basic_eval_stack& /*stack*/, value* /*vs*/) + { + inkFail("operation not implemented!"); + } }; } // namespace ink::runtime::internal diff --git a/inkcpp/output.cpp b/inkcpp/output.cpp index 164768f5..74c471aa 100644 --- a/inkcpp/output.cpp +++ b/inkcpp/output.cpp @@ -120,7 +120,7 @@ void basic_stream::append(const value* in, unsigned int length) } template -inline void write_char(T& output, char c) +inline void write_char(T& /*output*/, char /*c*/) { static_assert(always_false::value, "Invalid output type"); } diff --git a/inkcpp/string_operations.cpp b/inkcpp/string_operations.cpp index befe1041..d2de0a03 100644 --- a/inkcpp/string_operations.cpp +++ b/inkcpp/string_operations.cpp @@ -31,15 +31,13 @@ namespace casting const char* get() const { return _str; } private: - const value& _val; - const char* _str; - char _data[512]; // TODO define central + const char* _str; + char _data[512]; // TODO define central }; // constructor for string_cast class string_cast::string_cast(const value& val) - : _val{val} - , _str{nullptr} + : _str{nullptr} { if (val.type() == value_type::string) { // reference string if value is already a string diff --git a/inkcpp/string_table.h b/inkcpp/string_table.h index c7768a4d..0d093995 100644 --- a/inkcpp/string_table.h +++ b/inkcpp/string_table.h @@ -17,7 +17,7 @@ namespace ink::runtime::internal class string_table final : public snapshot_interface { public: - virtual ~string_table(); + ~string_table(); // Create a dynamic string of a particular length char* create(size_t length); diff --git a/inkcpp/value.h b/inkcpp/value.h index f3948ea0..46b56eec 100644 --- a/inkcpp/value.h +++ b/inkcpp/value.h @@ -134,6 +134,10 @@ class value : public snapshot_interface bool set(const ink::runtime::value& val); ink::runtime::value to_interface_value(list_table&) const; +#ifdef __GNUCC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtautological-compare" +#endif /// get value of the type (if possible) template typename ret::type get() const @@ -141,12 +145,16 @@ class value : public snapshot_interface static_assert(ty != ty, "No getter for this type defined!"); } +#ifdef __GNUCC__ +# pragma GCC diagnostic pop +#endif + /// check if value evaluates to true bool truthy(const list_table& lists) const; /// set value of type (if possible) template - constexpr value& set(Args... args) + constexpr value& set(Args...) { static_assert(sizeof...(Args) != sizeof...(Args), "No setter for this type defined!"); return *this; @@ -192,30 +200,37 @@ class value : public snapshot_interface } /// actual storage + struct value_jump { + uint32_t jump; + uint32_t thread_id; + }; + + struct value_frame { + uint32_t addr; + bool eval; // was eval mode active in frame above + }; + + struct value_pointer { + hash_t name; + int ci; + }; + union { + bool bool_value; int32_t int32_value; string_type string_value; uint32_t uint32_value; float float_value; - struct { - uint32_t jump; - uint32_t thread_id; - } jump; + value_jump jump; list_table::list list_value; list_flag list_flag_value; - struct { - uint32_t addr; - bool eval; // was eval mode active in frame above - } frame_value; + value_frame frame_value; - struct { - hash_t name; - int ci; - } pointer; + value_pointer pointer; }; static constexpr size_t max_value_size = sizeof_largest_type< diff --git a/inkcpp_c/tests/Globals.c b/inkcpp_c/tests/Globals.c index d6f02f8f..84824e37 100644 --- a/inkcpp_c/tests/Globals.c +++ b/inkcpp_c/tests/Globals.c @@ -1,7 +1,5 @@ #include #include -#include -#include #include @@ -12,7 +10,7 @@ HInkStory* story = NULL; HInkGlobals* store = NULL; HInkRunner* thread = NULL; -void setup() +void setup(void) { if (! story) { story = ink_story_from_file(INK_TEST_RESOURCE_DIR "GlobalStory.bin"); @@ -27,7 +25,7 @@ void setup() thread = ink_story_new_runner(story, store); } -int main() +int main(void) { //====== Just reading Globals ===== setup(); @@ -57,7 +55,7 @@ int main() val.int32_v = 30; assert(ink_globals_set(store, "age", val)); - // set value of 'friendl_name_of_player' + // set value of 'friendly_name_of_player' val.type = ValueTypeString; val.string_v = "Freddy"; assert(ink_globals_set(store, "friendly_name_of_player", val)); diff --git a/inkcpp_c/tests/Observer.c b/inkcpp_c/tests/Observer.c index b809eaf1..28f101a2 100644 --- a/inkcpp_c/tests/Observer.c +++ b/inkcpp_c/tests/Observer.c @@ -1,7 +1,5 @@ #include #include -#include -#include #include @@ -21,7 +19,7 @@ void observer(InkValue new_value, InkValue old_value) } } -int main() +int main(void) { HInkStory* story = ink_story_from_file(INK_TEST_RESOURCE_DIR "ObserverStory.bin"); HInkGlobals* store = ink_story_new_globals(story); diff --git a/inkcpp_c/tests/Snapshot.c b/inkcpp_c/tests/Snapshot.c index fcfaa59a..8d525d32 100644 --- a/inkcpp_c/tests/Snapshot.c +++ b/inkcpp_c/tests/Snapshot.c @@ -1,7 +1,5 @@ #include #include -#include -#include #include @@ -22,7 +20,7 @@ void check_end(HInkRunner* runner) assert(strcmp(ink_choice_text(ink_runner_get_choice(RUNNER, IDX)), STR) == 0) #define CHECK_NEXT_LINE(RUNNER, STR) assert(strcmp(ink_runner_get_line(RUNNER), STR) == 0) -int main() +int main(void) { { HInkStory* story = ink_story_from_file(INK_TEST_RESOURCE_DIR "SimpleStoryFlow.bin"); @@ -41,7 +39,7 @@ int main() ++cnt; } - // snapshot befroe choose, context (last output lines) can not bet optained at loading + // snapshot before choose, context (last output lines) can not bet obtained at loading HInkSnapshot* snap2 = ink_runner_create_snapshot(runner); check_end(runner); diff --git a/inkcpp_c/tests/Tags.c b/inkcpp_c/tests/Tags.c index 81b46ae0..546d57ad 100644 --- a/inkcpp_c/tests/Tags.c +++ b/inkcpp_c/tests/Tags.c @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,7 +6,7 @@ #undef NDEBUG #include -int main() +int main(void) { HInkStory* story = ink_story_from_file(INK_TEST_RESOURCE_DIR "TagsStory.bin"); HInkGlobals* store = ink_story_new_globals(story); diff --git a/inkcpp_test/Observer.cpp b/inkcpp_test/Observer.cpp index d5fd05fd..66069244 100644 --- a/inkcpp_test/Observer.cpp +++ b/inkcpp_test/Observer.cpp @@ -154,9 +154,9 @@ SCENARIO("Observer", "[observer][globals][runtime]") CHECK_FALSE(o_i.has_value()); } else { CHECK(i == 5); - CHECK(o_i.has_value()); - CHECK(o_i.value() == 1); - } + REQUIRE(o_i.has_value()); + CHECK(o_i.value() == 1); + } }; int var2_cnt = 0; auto var2 = [&var2_cnt](value v, ink::optional o_v) { @@ -167,11 +167,11 @@ SCENARIO("Observer", "[observer][globals][runtime]") CHECK_FALSE(o_v.has_value()); } else { CHECK(str == "test"); - CHECK(o_v.has_value()); - CHECK(o_v.value().type == value::Type::String); - std::string str2(o_v.value().get()); - CHECK(str2 == "hello"); - } + REQUIRE(o_v.has_value()); + CHECK(o_v.value().type == value::Type::String); + std::string str2(o_v.value().get()); + CHECK(str2 == "hello"); + } }; globals->observe("var1", var1); diff --git a/proofing/diff_py-codecs.patch b/proofing/diff_py-codecs.patch new file mode 100644 index 00000000..e6984bd9 --- /dev/null +++ b/proofing/diff_py-codecs.patch @@ -0,0 +1,23 @@ +diff --git a/diff.py b/diff.py +index 115bf2c..320607d 100644 +--- a/diff.py ++++ b/diff.py +@@ -1,7 +1,6 @@ + #!/usr/bin/env python3 + + import sys +-import codecs + from difflib import unified_diff + + if len(sys.argv) != 3: +@@ -9,8 +8,8 @@ if len(sys.argv) != 3: + + _, a, b = sys.argv + +-a_lines = codecs.open(a, encoding='utf-8-sig').read().splitlines() +-b_lines = codecs.open(b, encoding='utf-8-sig').read().splitlines() ++a_lines = open(a, encoding="utf-8-sig").read().splitlines() ++b_lines = open(b, encoding="utf-8-sig").read().splitlines() + + + out_lines = list(unified_diff(a_lines, b_lines, fromfile=a, tofile=b, lineterm=""))