diff --git a/.travis.yml b/.travis.yml index e18062f..8e9e125 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,48 +9,5 @@ jobs: script: - dotnet restore - dotnet build - - choco install opencover.portable - - choco install codecov - - OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:".\UnitTests\bin\Debug\netcoreapp2.1\UnitTests.dll -noshadow" -filter:"+[Validator*]* -[UnitTests*]*" -output:".\Validator_Coverage.xml" - - codecov -f "Validator_Coverage.xml" - - - language: objective-c - os: osx - rvm: - - 2.2 #see before_install for getting RVM stable. - - env: - - TRAVIS_TAG="Deploy-main" PROJECT_NAME="BivalenceWorld" UNITY_PROJECT_PATH="BivalenceWorld" DEPLOY_UNITYPACKAGE="path set in deploy script" - - - cache: - directories: - - $UNITY_DOWNLOAD_CACHE - - - before_install: - - chmod a+x ./travis-build/*.sh - - install: - - cat /etc/hosts - - ./travis-build/install-unity.sh - - script: - - ./travis-build/build.sh - - ./travis-build/run-tests.sh - - after_success: - - ./travis-build/export-unity-package.sh - - before_deploy: - - DEPLOY_UNITYPACKAGE="$(ls -a release/*.zip | head -n 1)" - - deploy: - provider: releases - api_key: $GITHUB_TOKEN - file: $DEPLOY_UNITYPACKAGE - skip_cleanup: true - overwrite: true - on: - tags: true + - dotnet test \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index ecb4c4b..0000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -test: SHELL:=/bin/bash -test: - bash <(curl -fsSL https://raw.githubusercontent.com/neogeek/unity-ci-tools/v1.0.0/bin/test.sh) - -clean: - git clean -xdf \ No newline at end of file diff --git a/Validator/BivalenceWorld/BivalenceWorld.csproj b/Validator/BivalenceWorld/BivalenceWorld.csproj index 73ffdb1..fc4bca5 100644 --- a/Validator/BivalenceWorld/BivalenceWorld.csproj +++ b/Validator/BivalenceWorld/BivalenceWorld.csproj @@ -4,6 +4,11 @@ netstandard2.0 + + full + true + + diff --git a/Validator/UnitTests/Test_DiceGame/GameRuleSet.cs b/Validator/UnitTests/Test_DiceGame/GameRuleSet.cs deleted file mode 100644 index ddb48aa..0000000 --- a/Validator/UnitTests/Test_DiceGame/GameRuleSet.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -public class GameRuleSet -{ - private const string AllQuantum = "\u2200"; - private const string ExistQuantum = "\u2203"; - private const string Implication = "\u2192"; - private const string AND = "\u2227"; - private const string OR = "\u2228"; - - - public static List GetRule(ERule rule) - { - switch (rule) - { - case ERule.SelectionPossible: - return new List - { - $"{AllQuantum}x (Selected(x) {Implication} (" + - $"(DiceOne(x) {AND} {AllQuantum}y (NotEquals(x,y) {Implication} NotSelected(y)))" + - $"{OR} {ExistQuantum}y (DiceTwo(x) {AND} DiceTwo(y) {AND} NotEquals(x,y) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u)) {Implication} NotSelected(u)))" + - $"{OR} (DiceThree(x) {AND} {AllQuantum}y (NotEquals(x,y) {Implication} NotSelected(y)))" + - $"{OR} {ExistQuantum}y (DiceThree(x) {AND} DiceThree(y) {AND} NotEquals(x,y) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u)) {Implication} NotSelected(u)))" + - $"{OR} {ExistQuantum}y {ExistQuantum}z (DiceThree(x) {AND} DiceThree(y) {AND} DiceThree(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} NotEquals(y,z) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u) {AND} NotEquals(z,u)) {Implication} NotSelected(u)))" + - $"{OR} {ExistQuantum}y (DiceFour(x) {AND} DiceFour(y) {AND} NotEquals(x,y) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u)) {Implication} NotSelected(u)))" + - $"{OR} {ExistQuantum}y {ExistQuantum}z (DiceFour(x) {AND} DiceFour(y) {AND} DiceFour(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} NotEquals(y,z) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u) {AND} NotEquals(z,u)) {Implication} NotSelected(u)))" + - $"{OR} {ExistQuantum}y (DiceFive(x) {AND} DiceFive(y) {AND} NotEquals(x,y) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u)) {Implication} NotSelected(u)))" + - $"{OR} {ExistQuantum}y {ExistQuantum}z (DiceFive(x) {AND} DiceFive(y) {AND} DiceFive(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} NotEquals(y,z) {AND} {AllQuantum}u ((NotEquals(x,u) {AND} NotEquals(y,u) {AND} NotEquals(z,u)) {Implication} NotSelected(u)))" + - $"{OR} (DiceSix(x) {AND} {AllQuantum}y (NotEquals(x,y) {Implication} NotSelected(y)))))" - }; - case ERule.Dice1x1: - return new List - { - $"{ExistQuantum}x (Selected(x) {AND} DiceOne(x)" + - $"{AND} {AllQuantum}u (NotEquals(u,x) {Implication} NotSelected(u)))" - }; - case ERule.Dice2x2: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y (Selected(x) {AND} Selected(y) {AND} NotEquals(x,y) {AND} DiceTwo(x) {AND} DiceTwo(y)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y)) {Implication} NotSelected(u)))" - }; - case ERule.Dice1x3: - return new List - { - $"{ExistQuantum}x (Selected(x) {AND} DiceThree(x)" + - $"{AND} {AllQuantum}u (NotEquals(u,x) {Implication} NotSelected(u)))" - }; - case ERule.Dice2x3: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y (Selected(x) {AND} Selected(y) {AND} NotEquals(x,y) {AND} DiceThree(x) {AND} DiceThree(y)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y)) {Implication} NotSelected(u)))" - }; - case ERule.Dice3x3: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y {ExistQuantum}z (Selected(x) {AND} Selected(y) {AND} Selected(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} DiceThree(x) {AND} DiceThree(y) {AND} DiceThree(z)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y) {AND} NotEquals(u,z)) {Implication} NotSelected(u)))" - }; - case ERule.Dice2x4: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y (Selected(x) {AND} Selected(y) {AND} NotEquals(x,y) {AND} DiceFour(x) {AND} DiceFour(y)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y)) {Implication} NotSelected(u)))" - }; - case ERule.Dice3x4: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y {ExistQuantum}z (Selected(x) {AND} Selected(y) {AND} Selected(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} DiceFour(x) {AND} DiceFour(y) {AND} DiceFour(z)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y) {AND} NotEquals(u,z)) {Implication} NotSelected(u)))" - }; - case ERule.Dice2x5: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y (Selected(x) {AND} Selected(y) {AND} NotEquals(x,y) {AND} DiceFive(x) {AND} DiceFive(y)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y)) {Implication} NotSelected(u)))" - }; - case ERule.Dice3x5: - return new List - { - $"{ExistQuantum}x {ExistQuantum}y {ExistQuantum}z (Selected(x) {AND} Selected(y) {AND} Selected(z) {AND} NotEquals(x,y) {AND} NotEquals(x,z) {AND} NotEquals(y,z) {AND} DiceFive(x) {AND} DiceFive(y) {AND} DiceFive(z)" + - $"{AND} {AllQuantum}u ((NotEquals(u,x) {AND} NotEquals(u,y) {AND} NotEquals(u,z)) {Implication} NotSelected(u)))" - }; - case ERule.Dice1x6: - return new List - { - $"{ExistQuantum}x (Selected(x) {AND} DiceSix(x)" + - $"{AND} {AllQuantum}u (NotEquals(u,x) {Implication} NotSelected(u)))" - }; - default: - return new List() { }; - } - } - - public enum ERule - { - Dice1x1, - Dice2x2, - Dice1x3, - Dice2x3, - Dice3x3, - Dice2x4, - Dice3x4, - Dice2x5, - Dice3x5, - Dice1x6, - SelectionPossible - } -} diff --git a/Validator/UnitTests/Test_DiceGame/GameWorld.cs b/Validator/UnitTests/Test_DiceGame/GameWorld.cs deleted file mode 100644 index 45aadad..0000000 --- a/Validator/UnitTests/Test_DiceGame/GameWorld.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Validator; - - -public class GameWorld : AWorld -{ - protected override Dictionary CreateFunctionDictionary() - { - return new Dictionary - { - - }; - } - - protected override Dictionary CreatePredicateDictionary() - { - return new Dictionary - { - { GameWorldFields.NOTEQUALS, new NotEquals() } - }; - } - - protected override Signature CreateSignature() - { - return new Signature - { - Consts = new List - { - "1", - "2", - "3", - "4", - "5", - "6" - }, - Predicates = new List<(string, int)> - { - (GameWorldFields.DICEONE, 1), - (GameWorldFields.DICETWO, 1), - (GameWorldFields.DICETHREE, 1), - (GameWorldFields.DICEFOUR, 1), - (GameWorldFields.DICEFIVE, 1), - (GameWorldFields.DICESIX, 1), - (GameWorldFields.SELECTED, 1), - (GameWorldFields.NOTSELECTED, 1), - (GameWorldFields.NOTEQUALS, 2) - }, - Functions = new List<(string, int)> - { - - } - }; - } -} diff --git a/Validator/UnitTests/Test_DiceGame/GameWorldFields.cs b/Validator/UnitTests/Test_DiceGame/GameWorldFields.cs deleted file mode 100644 index 7899d03..0000000 --- a/Validator/UnitTests/Test_DiceGame/GameWorldFields.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -public static class GameWorldFields -{ - public const string DICEONE = "DiceOne"; - public const string DICETWO = "DiceTwo"; - public const string DICETHREE = "DiceThree"; - public const string DICEFOUR = "DiceFour"; - public const string DICEFIVE = "DiceFive"; - public const string DICESIX = "DiceSix"; - - public const string NOTEQUALS = "NotEquals"; - - public const string SELECTED = "Selected"; - public const string NOTSELECTED = "NotSelected"; -} diff --git a/Validator/UnitTests/Test_DiceGame/NotEquals.cs b/Validator/UnitTests/Test_DiceGame/NotEquals.cs deleted file mode 100644 index 8b33679..0000000 --- a/Validator/UnitTests/Test_DiceGame/NotEquals.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Validator; - -public class NotEquals : IPredicateValidation -{ - public bool Check(List obj) - { - if (obj.Count != 2) - { - throw new Exception("Invalid NotEquals Parameter"); - } - else - { - WorldObject o1 = obj[0]; - WorldObject o2 = obj[1]; - - string id1 = o1.Consts.FirstOrDefault(); - string id2 = o2.Consts.FirstOrDefault(); - - return id1 != id2; - } - } -} diff --git a/Validator/UnitTests/Test_DiceGame/Test_DiceGame_Performance.cs b/Validator/UnitTests/Test_DiceGame/Test_DiceGame_Performance.cs deleted file mode 100644 index 1fbeedf..0000000 --- a/Validator/UnitTests/Test_DiceGame/Test_DiceGame_Performance.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Validator; -using Validator.World; - -namespace UnitTests.Test_DiceGame -{ - [TestClass] - public class Test_DiceGame_Performance - { - [TestMethod] - public void Test_Performance_LongSentence() - { - List worldObjects = new List - { - new WorldObject(new List { "1" }, new List {GameWorldFields.DICEONE , GameWorldFields.SELECTED }, new List()), - new WorldObject(new List { "2" }, new List {GameWorldFields.DICEONE , GameWorldFields.NOTSELECTED }, new List()), - new WorldObject(new List { "3" }, new List {GameWorldFields.DICETWO , GameWorldFields.NOTSELECTED }, new List()), - new WorldObject(new List { "4" }, new List {GameWorldFields.DICETHREE , GameWorldFields.NOTSELECTED }, new List()), - new WorldObject(new List { "5" }, new List {GameWorldFields.DICEFOUR , GameWorldFields.NOTSELECTED }, new List()), - new WorldObject(new List { "6" }, new List {GameWorldFields.DICESIX , GameWorldFields.NOTSELECTED }, new List()) - }; - - AWorld world = new GameWorld(); - var result = world.Check(new WorldParameter(worldObjects, GameRuleSet.GetRule(GameRuleSet.ERule.SelectionPossible))); - - Assert.IsTrue(result.Result.Value[0].Value == EValidationResult.True); - } - } -} diff --git a/Validator/UnitTests/UnitTests.csproj b/Validator/UnitTests/UnitTests.csproj index cf3ca8e..dba1b10 100644 --- a/Validator/UnitTests/UnitTests.csproj +++ b/Validator/UnitTests/UnitTests.csproj @@ -6,6 +6,11 @@ false + + full + true + + diff --git a/Validator/Validator/Validator.csproj b/Validator/Validator/Validator.csproj index c080cb1..e7852b0 100644 --- a/Validator/Validator/Validator.csproj +++ b/Validator/Validator/Validator.csproj @@ -4,7 +4,13 @@ netstandard2.0 + + full + true + + + diff --git a/travis-build/build.sh b/travis-build/build.sh deleted file mode 100644 index 7a94ad4..0000000 --- a/travis-build/build.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh - -PROJECT_PATH=$(pwd)/$UNITY_PROJECT_PATH -UNITY_BUILD_DIR=$(pwd)/Build -LOG_FILE=$UNITY_BUILD_DIR/unity-win.log - - -ERROR_CODE=0 -echo "Items in project path ($PROJECT_PATH):" -ls "$PROJECT_PATH" - - -echo "Building project for Windows..." -mkdir $UNITY_BUILD_DIR -/Applications/Unity/Unity.app/Contents/MacOS/Unity \ - -batchmode \ - -nographics \ - -silent-crashes \ - -logFile \ - -projectPath "$PROJECT_PATH" \ - -buildWindows64Player "$(pwd)/build/win/ci-build.exe" \ - -quit \ - | tee "$LOG_FILE" - -if [ $? = 0 ] ; then - echo "Building Windows exe completed successfully." - ERROR_CODE=0 -else - echo "Building Windows exe failed. Exited with $?." - ERROR_CODE=1 -fi - -#echo 'Build logs:' -#cat $LOG_FILE - -echo "Finishing with code $ERROR_CODE" -exit $ERROR_CODE \ No newline at end of file diff --git a/travis-build/export-unity-package.sh b/travis-build/export-unity-package.sh deleted file mode 100644 index 3012c61..0000000 --- a/travis-build/export-unity-package.sh +++ /dev/null @@ -1,57 +0,0 @@ -#! /bin/sh - -PROJECT_PATH=$(pwd)/$UNITY_PROJECT_PATH -UNITY_BUILD_DIR=$(pwd)/Build -LOG_FILE=$UNITY_BUILD_DIR/unity-win.log -EXPORT_PATH=$(pwd)/$PROJECT_NAME-v"$TRAVIS_TAG"-b"$TRAVIS_BUILD_NUMBER".unitypackage -RELEASE_DIRECTORY=./release - - -ERROR_CODE=0 - -echo "Creating package at=$EXPORT_PATH" -mkdir $UNITY_BUILD_DIR -/Applications/Unity/Unity.app/Contents/MacOS/Unity \ - -batchmode \ - -nographics \ - -silent-crashes \ - -logFile \ - -projectPath "$PROJECT_PATH" \ - -exportPackage "Assets" "$EXPORT_PATH" \ - -quit \ - | tee "$LOG_FILE" - -if [ $? = 0 ] ; then - echo "Created package successfully." - ERROR_CODE=0 - - echo "Packaging unity package into release..." - #Preprare release unity package by packing into ZIP - RELEASE_ZIP_FILE=$RELEASE_DIRECTORY/$PROJECT_NAME-v$TRAVIS_TAG.zip - - mkdir -p $RELEASE_DIRECTORY - - echo "Preparing release for version: $TRAVIS_TAG" - cp "$EXPORT_PATH" "$RELEASE_DIRECTORY/"`basename "$EXPORT_PATH"` - cp "./README.md" "$RELEASE_DIRECTORY" - cp "./LICENSE" "$RELEASE_DIRECTORY" - - echo "Files in release directory:" - ls $RELEASE_DIRECTORY - - zip -6 -r $RELEASE_ZIP_FILE $RELEASE_DIRECTORY - - echo "Release zip package ready. Zipinfo:" - zipinfo $RELEASE_ZIP_FILE - -else - echo "Creating package failed. Exited with $?." - ls - ERROR_CODE=1 -fi - -#echo 'Build logs:' -#cat $LOG_FILE - -echo "Export finished with code $ERROR_CODE" -exit $ERROR_CODE diff --git a/travis-build/install-unity.sh b/travis-build/install-unity.sh deleted file mode 100644 index 0c04d7a..0000000 --- a/travis-build/install-unity.sh +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh - -# See https://unity3d.com/get-unity/download/archive -# to get download URLs -UNITY_DOWNLOAD_CACHE="$(pwd)/unity_download_cache" -UNITY_OSX_PACKAGE_URL="https://download.unity3d.com/download_unity/27ab2135bccf/MacEditorInstaller/Unity-2019.3.0f6.pkg" -UNITY_WINDOWS_TARGET_PACKAGE_URL="https://download.unity3d.com/download_unity/27ab2135bccf/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2019.3.0f6.pkg" - - -# Downloads a file if it does not exist -download() { - - URL=$1 - FILE=`basename "$URL"` - - # Downloads a package if it does not already exist in cache - if [ ! -e $UNITY_DOWNLOAD_CACHE/`basename "$URL"` ] ; then - echo "$FILE does not exist. Downloading from $URL: " - mkdir -p "$UNITY_DOWNLOAD_CACHE" - curl -o $UNITY_DOWNLOAD_CACHE/`basename "$URL"` "$URL" - else - echo "$FILE Exists. Skipping download." - fi -} - -# Downloads and installs a package from an internet URL -install() { - PACKAGE_URL=$1 - download $1 - - echo "Installing `basename "$PACKAGE_URL"`" - sudo installer -dumplog -package $UNITY_DOWNLOAD_CACHE/`basename "$PACKAGE_URL"` -target / -} - - - -echo "Contents of Unity Download Cache:" -ls $UNITY_DOWNLOAD_CACHE - -echo "Installing Unity..." -install $UNITY_OSX_PACKAGE_URL -install $UNITY_WINDOWS_TARGET_PACKAGE_URL diff --git a/travis-build/run-tests.sh b/travis-build/run-tests.sh deleted file mode 100644 index fca1580..0000000 --- a/travis-build/run-tests.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh - -echo "Skipping testing. No Tests implemented yet..." -exit 0 \ No newline at end of file