mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 20:38:47 +00:00
Merge branch 'release/4.0.0' into feature/generic_math
This commit is contained in:
commit
be44b9d549
18
.github/workflows/activate-unity.yml
vendored
18
.github/workflows/activate-unity.yml
vendored
@ -1,18 +0,0 @@
|
|||||||
name: Acquire activation file
|
|
||||||
on:
|
|
||||||
workflow_dispatch: {}
|
|
||||||
jobs:
|
|
||||||
activation:
|
|
||||||
name: Request manual activation file 🔑
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Request manual activation file
|
|
||||||
- name: Request manual activation file
|
|
||||||
id: getManualLicenseFile
|
|
||||||
uses: game-ci/unity-request-activation-file@v2
|
|
||||||
# Upload artifact (Unity_v20XX.X.XXXX.alf)
|
|
||||||
- name: Expose as artifact
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
|
|
||||||
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
|
|
8
.github/workflows/dotnet.yml
vendored
8
.github/workflows/dotnet.yml
vendored
@ -23,9 +23,9 @@ jobs:
|
|||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
3.1.x
|
|
||||||
6.0.x
|
6.0.x
|
||||||
7.0.x
|
7.0.x
|
||||||
|
8.0.x
|
||||||
|
|
||||||
- name: Add NuGet source
|
- name: Add NuGet source
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
||||||
@ -36,11 +36,11 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build --no-restore --configuration Release
|
run: dotnet build --no-restore --configuration Release
|
||||||
|
|
||||||
- name: Test .NET Core 3.1
|
|
||||||
run: dotnet test --no-build --verbosity normal --configuration Release --framework netcoreapp3.1
|
|
||||||
|
|
||||||
- name: Test .NET 6
|
- name: Test .NET 6
|
||||||
run: dotnet test --no-build --verbosity normal --configuration Release --framework net6.0
|
run: dotnet test --no-build --verbosity normal --configuration Release --framework net6.0
|
||||||
|
|
||||||
- name: Test .NET 7
|
- name: Test .NET 7
|
||||||
run: dotnet test --no-build --verbosity normal --configuration Release --framework net7.0
|
run: dotnet test --no-build --verbosity normal --configuration Release --framework net7.0
|
||||||
|
|
||||||
|
- name: Test .NET 8
|
||||||
|
run: dotnet test --no-build --verbosity normal --configuration Release --framework net8.0
|
||||||
|
42
.github/workflows/nightly.yml
vendored
42
.github/workflows/nightly.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 7.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Add GitHub NuGet source
|
- name: Add GitHub NuGet source
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
||||||
@ -34,7 +34,6 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
dotnet pack X10D --configuration Debug --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='nightly' -p:BuildNumber=${{ github.run_number }}
|
dotnet pack X10D --configuration Debug --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='nightly' -p:BuildNumber=${{ github.run_number }}
|
||||||
dotnet pack X10D.Hosting --configuration Debug --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='nightly' -p:BuildNumber=${{ github.run_number }}
|
dotnet pack X10D.Hosting --configuration Debug --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='nightly' -p:BuildNumber=${{ github.run_number }}
|
||||||
dotnet pack X10D.Unity --configuration Debug --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='nightly' -p:BuildNumber=${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Push NuGet Package to GitHub
|
- name: Push NuGet Package to GitHub
|
||||||
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
||||||
@ -47,42 +46,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: build
|
name: build
|
||||||
path: build/
|
path: build/
|
||||||
|
|
||||||
- name: Checkout upm branch
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: upm
|
|
||||||
path: upm
|
|
||||||
|
|
||||||
- name: Build package.json
|
|
||||||
run: |
|
|
||||||
dotnet run --project ./tools/UpmPackageGenerator/UpmPackageGenerator.csproj "./X10D/bin/Debug/netstandard2.1/X10D.dll"
|
|
||||||
cp package.json upm/package.json
|
|
||||||
|
|
||||||
- name: Copy built artifacts to upm
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
cp ../X10D/bin/Debug/netstandard2.1/X10D.dll ./X10D.dll
|
|
||||||
cp ../X10D/bin/Debug/netstandard2.1/X10D.xml ./X10D.xml
|
|
||||||
cp ../X10D.Unity/bin/Debug/netstandard2.1/X10D.Unity.dll ./X10D.Unity.dll
|
|
||||||
cp ../X10D.Unity/bin/Debug/netstandard2.1/X10D.Unity.xml ./X10D.Unity.xml
|
|
||||||
|
|
||||||
- name: Check for changes
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git diff --quiet
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Commit update
|
|
||||||
if: ${{ success() }}
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git config user.name github-actions
|
|
||||||
git config user.email github-actions@github.com
|
|
||||||
git add X10D.dll
|
|
||||||
git add X10D.Unity.dll
|
|
||||||
git add X10D.xml
|
|
||||||
git add X10D.Unity.xml
|
|
||||||
git add package.json
|
|
||||||
git commit -m "Update upm branch ($GITHUB_SHA)"
|
|
||||||
git push
|
|
||||||
|
42
.github/workflows/prerelease.yml
vendored
42
.github/workflows/prerelease.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 7.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Add GitHub NuGet source
|
- name: Add GitHub NuGet source
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
||||||
@ -33,7 +33,6 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
dotnet pack X10D --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='prerelease' -p:BuildNumber=${{ github.run_number }}
|
dotnet pack X10D --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='prerelease' -p:BuildNumber=${{ github.run_number }}
|
||||||
dotnet pack X10D.Hosting --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='prerelease' -p:BuildNumber=${{ github.run_number }}
|
dotnet pack X10D.Hosting --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='prerelease' -p:BuildNumber=${{ github.run_number }}
|
||||||
dotnet pack X10D.Unity --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build -p:VersionSuffix='prerelease' -p:BuildNumber=${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Push NuGet Package to GitHub
|
- name: Push NuGet Package to GitHub
|
||||||
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
||||||
@ -52,42 +51,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
- name: Checkout upm branch
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: upm
|
|
||||||
path: upm
|
|
||||||
|
|
||||||
- name: Build package.json
|
|
||||||
run: |
|
|
||||||
dotnet run --project ./tools/UpmPackageGenerator/UpmPackageGenerator.csproj "./X10D/bin/Release/netstandard2.1/X10D.dll"
|
|
||||||
cp package.json upm/package.json
|
|
||||||
|
|
||||||
- name: Copy built artifacts to upm
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
cp ../X10D/bin/Release/netstandard2.1/X10D.dll ./X10D.dll
|
|
||||||
cp ../X10D/bin/Release/netstandard2.1/X10D.xml ./X10D.xml
|
|
||||||
cp ../X10D.Unity/bin/Release/netstandard2.1/X10D.Unity.dll ./X10D.Unity.dll
|
|
||||||
cp ../X10D.Unity/bin/Release/netstandard2.1/X10D.Unity.xml ./X10D.Unity.xml
|
|
||||||
|
|
||||||
- name: Check for changes
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git diff --quiet
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Commit update
|
|
||||||
if: ${{ success() }}
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git config user.name github-actions
|
|
||||||
git config user.email github-actions@github.com
|
|
||||||
git add X10D.dll
|
|
||||||
git add X10D.Unity.dll
|
|
||||||
git add X10D.xml
|
|
||||||
git add X10D.Unity.xml
|
|
||||||
git add package.json
|
|
||||||
git commit -m "Update upm branch ($GITHUB_SHA)"
|
|
||||||
git push
|
|
||||||
|
42
.github/workflows/release.yml
vendored
42
.github/workflows/release.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 7.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Add GitHub NuGet source
|
- name: Add GitHub NuGet source
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
||||||
@ -33,7 +33,6 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
dotnet pack X10D --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build
|
dotnet pack X10D --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build
|
||||||
dotnet pack X10D.Hosting --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build
|
dotnet pack X10D.Hosting --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build
|
||||||
dotnet pack X10D.Unity --configuration Release --no-build -p:SymbolPackageFormat=snupkg --include-symbols --include-source -o build
|
|
||||||
|
|
||||||
- name: Push NuGet Package to GitHub
|
- name: Push NuGet Package to GitHub
|
||||||
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
run: dotnet nuget push "build/*" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
|
||||||
@ -52,42 +51,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
- name: Checkout upm branch
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: upm
|
|
||||||
path: upm
|
|
||||||
|
|
||||||
- name: Build package.json
|
|
||||||
run: |
|
|
||||||
dotnet run --project ./tools/UpmPackageGenerator/UpmPackageGenerator.csproj "./X10D/bin/Release/netstandard2.1/X10D.dll"
|
|
||||||
cp package.json upm/package.json
|
|
||||||
|
|
||||||
- name: Copy built artifacts to upm
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
cp ../X10D/bin/Release/netstandard2.1/X10D.dll ./X10D.dll
|
|
||||||
cp ../X10D/bin/Release/netstandard2.1/X10D.xml ./X10D.xml
|
|
||||||
cp ../X10D.Unity/bin/Release/netstandard2.1/X10D.Unity.dll ./X10D.Unity.dll
|
|
||||||
cp ../X10D.Unity/bin/Release/netstandard2.1/X10D.Unity.xml ./X10D.Unity.xml
|
|
||||||
|
|
||||||
- name: Check for changes
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git diff --quiet
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Commit update
|
|
||||||
if: ${{ success() }}
|
|
||||||
run: |
|
|
||||||
cd upm
|
|
||||||
git config user.name github-actions
|
|
||||||
git config user.email github-actions@github.com
|
|
||||||
git add X10D.dll
|
|
||||||
git add X10D.Unity.dll
|
|
||||||
git add X10D.xml
|
|
||||||
git add X10D.Unity.xml
|
|
||||||
git add package.json
|
|
||||||
git commit -m "Update upm branch ($GITHUB_SHA)"
|
|
||||||
git push
|
|
||||||
|
33
.github/workflows/sonarcloud.yml
vendored
33
.github/workflows/sonarcloud.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Build
|
name: SonarCloud
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -6,45 +6,56 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ opened, synchronize, reopened ]
|
types: [ opened, synchronize, reopened ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
sonarcloud:
|
||||||
name: Build
|
name: SonarCloud Analysis
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: 1.11
|
java-version: 17
|
||||||
|
distribution: 'zulu'
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
|
|
||||||
- name: Cache SonarCloud packages
|
- name: Cache SonarCloud packages
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~\sonar\cache
|
path: ~\sonar\cache
|
||||||
key: ${{ runner.os }}-sonar
|
key: ${{ runner.os }}-sonar
|
||||||
restore-keys: ${{ runner.os }}-sonar
|
restore-keys: ${{ runner.os }}-sonar
|
||||||
|
|
||||||
- name: Cache SonarCloud scanner
|
- name: Cache SonarCloud scanner
|
||||||
id: cache-sonar-scanner
|
id: cache-sonar-scanner
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: .\.sonar\scanner
|
path: .\.sonar\scanner
|
||||||
key: ${{ runner.os }}-sonar-scanner
|
key: ${{ runner.os }}-sonar-scanner
|
||||||
restore-keys: ${{ runner.os }}-sonar-scanner
|
restore-keys: ${{ runner.os }}-sonar-scanner
|
||||||
|
|
||||||
- name: Install SonarCloud scanner
|
- name: Install SonarCloud scanner
|
||||||
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
|
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
New-Item -Path .\.sonar\scanner -ItemType Directory
|
New-Item -Path .\.sonar\scanner -ItemType Directory
|
||||||
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
|
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
|
||||||
|
|
||||||
|
- name: Install dotCover
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
dotnet tool install --global JetBrains.dotCover.GlobalTool
|
||||||
|
|
||||||
- name: Build and analyze
|
- name: Build and analyze
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
dotnet tool install JetBrains.dotCover.GlobalTool -g
|
.\.sonar\scanner\dotnet-sonarscanner begin /k:"oliverbooth_X10D" /o:"oliverbooth" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
|
||||||
.\.sonar\scanner\dotnet-sonarscanner begin /k:"oliverbooth_X10D" /o:"oliverbooth" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html
|
|
||||||
dotnet build --no-incremental
|
dotnet build --no-incremental
|
||||||
dotnet dotcover test --dcReportType=HTML
|
dotnet dotcover test --dcReportType=HTML
|
||||||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
|
||||||
|
4
.github/workflows/source_validator.yml
vendored
4
.github/workflows/source_validator.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: 7.0.x
|
dotnet-version: 8.0.x
|
||||||
|
|
||||||
- name: Add GitHub NuGet source
|
- name: Add GitHub NuGet source
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
||||||
@ -31,4 +31,4 @@ jobs:
|
|||||||
run: dotnet build -c Debug
|
run: dotnet build -c Debug
|
||||||
|
|
||||||
- name: Run Source Validation
|
- name: Run Source Validation
|
||||||
run: dotnet run --project ./tools/SourceValidator/SourceValidator.csproj ./X10D/src ./X10D.Unity/src
|
run: dotnet run --project ./tools/SourceValidator/SourceValidator.csproj ./X10D/src
|
||||||
|
50
.github/workflows/unity.yml
vendored
50
.github/workflows/unity.yml
vendored
@ -1,50 +0,0 @@
|
|||||||
name: Unity Test Runner
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
- '*/*'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
- '*/*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: "Unity Test Runner"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 7.0.x
|
|
||||||
|
|
||||||
- name: Add GitHub NuGet source
|
|
||||||
run: dotnet nuget add source --username oliverbooth --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/oliverbooth/index.json"
|
|
||||||
|
|
||||||
- name: Restore dependencies
|
|
||||||
run: dotnet restore
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build -c Release
|
|
||||||
|
|
||||||
- name: Copy artifacts to project
|
|
||||||
run: |
|
|
||||||
mkdir -p ./X10D.Unity.Tests/Assets/Libraries
|
|
||||||
cp -r ./X10D/bin/Release/netstandard2.1/X10D.dll ./X10D.Unity.Tests/Assets/Libraries/X10D.dll
|
|
||||||
cp -r ./X10D.Unity/bin/Release/netstandard2.1/X10D.Unity.dll ./X10D.Unity.Tests/Assets/Libraries/X10D.Unity.dll
|
|
||||||
|
|
||||||
- name: Unity - Test runner
|
|
||||||
uses: game-ci/unity-test-runner@v2.1.0
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
||||||
with:
|
|
||||||
projectPath: X10D.Unity.Tests
|
|
||||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
13
CHANGELOG.md
13
CHANGELOG.md
@ -24,8 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- X10D: Added `TextWriter.WriteLineNoAlloc(long[, ReadOnlySpan<char>[, IFormatProvider]])`.
|
- X10D: Added `TextWriter.WriteLineNoAlloc(long[, ReadOnlySpan<char>[, IFormatProvider]])`.
|
||||||
- X10D: Added `TextWriter.WriteLineNoAlloc(ulong[, ReadOnlySpan<char>[, IFormatProvider]])`.
|
- X10D: Added `TextWriter.WriteLineNoAlloc(ulong[, ReadOnlySpan<char>[, IFormatProvider]])`.
|
||||||
- X10D: Added `string.ConcatIf`.
|
- X10D: Added `string.ConcatIf`.
|
||||||
- X10D.Unity: Added `RaycastHit.GetComponent` and `RaycastHit.TryGetComponent`.
|
- X10D: Added `string.MDBold`, `string.MDCode`, `string.MDCodeBlock([string])`, `string.MDHeading(int)`,
|
||||||
- X10D.Unity: Added `DebugUtility.DrawFunction`, and `DebugUtility.DrawUnjoinedPolyhedron` on which it relies.
|
`string.MDItalic`, `string.MDLink`, `string.MDStrikeOut`, and `string.MDUnderline` for Markdown formatting.
|
||||||
|
- X10D: Added Span overloads which complement `char.Repeat` and `string.Repeat`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
@ -38,12 +39,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
BigEndian/LittleEndian methods.
|
BigEndian/LittleEndian methods.
|
||||||
- X10D: `Stream.GetHash<>` and `Stream.TryWriteHash<>` now throw ArgumentException in lieu of
|
- X10D: `Stream.GetHash<>` and `Stream.TryWriteHash<>` now throw ArgumentException in lieu of
|
||||||
TypeInitializationException.
|
TypeInitializationException.
|
||||||
|
- X10D: `char.IsEmoji` no longer allocates for .NET 7.
|
||||||
|
- X10D: `string.Repeat` is now more efficient.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- X10D: Removed `IEnumerable<T>.ConcatOne` - this functionality already exists with `Append`.
|
- X10D: Removed `IEnumerable<T>.ConcatOne` - this functionality already exists with `Append`.
|
||||||
- X10D: Removed `Endianness` enum.
|
- X10D: Removed `Endianness` enum.
|
||||||
- X10D.DSharpPlus: Complete sunset of library. This library will not be updated to support DSharpPlus v5.0.0.
|
- X10D: Removed `Span<T>.Replace(T, T)` for .NET 8 target.
|
||||||
|
- X10D: Removed .NET Standard 2.1 target.
|
||||||
|
- X10D.Hosting: Removed .NET Standard 2.1 target.
|
||||||
|
- X10D.DSharpPlus: Complete sunset of library. This library will not be updated to support DSharpPlus v5.0.0 (#83).
|
||||||
|
- X10D.Unity: Complete sunset of library. This library will not be updated effective immediately (#86).
|
||||||
|
|
||||||
## [3.3.1] - 2023-08-21
|
## [3.3.1] - 2023-08-21
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0;net6.0;netstandard2.1</TargetFrameworks>
|
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
@ -21,7 +20,7 @@
|
|||||||
<PackageIconUrl/>
|
<PackageIconUrl/>
|
||||||
<PackageTags>dotnet extension-methods</PackageTags>
|
<PackageTags>dotnet extension-methods</PackageTags>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(SolutionDir)/CHANGELOG.md"))</PackageReleaseNotes>
|
<PackageReleaseNotes>See CHANGELOG.md for a full list of changes.</PackageReleaseNotes>
|
||||||
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
|
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
98
README.md
98
README.md
@ -9,29 +9,115 @@
|
|||||||
<a href="https://github.com/oliverbooth/X10D/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/oliverbooth/X10D?style=flat-square" alt="MIT License" title="MIT License"></a>
|
<a href="https://github.com/oliverbooth/X10D/blob/master/LICENSE.md"><img src="https://img.shields.io/github/license/oliverbooth/X10D?style=flat-square" alt="MIT License" title="MIT License"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### About
|
## About
|
||||||
X10D (pronounced *extend*), is a .NET package that provides extension methods for numerous types. The purpose of this library is to simplify a codebase by reducing the need for repeated code when performing common operations. Simplify your codebase. Take advantage of .NET. Use extension methods.
|
X10D (pronounced *extend*), is a .NET package that provides extension methods for numerous types. The purpose of this library is to simplify a codebase by reducing the need for repeated code when performing common operations. Simplify your codebase. Take advantage of .NET. Use extension methods.
|
||||||
|
|
||||||
*(I'm also [dogfooding](https://www.pcmag.com/encyclopedia/term/dogfooding) this library, so there's that.)*
|
*(I'm also [dogfooding](https://www.pcmag.com/encyclopedia/term/dogfooding) this library, so there's that.)*
|
||||||
|
|
||||||
|
### What are extension methods?
|
||||||
|
|
||||||
|
Extension methods are a clever .NET feature that augment existing types with new functionality. They are defined as
|
||||||
|
static methods in a static class, and are called as if they were instance methods on the type they are extending. Take,
|
||||||
|
for example, the following code:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
string str = "Hello, world!";
|
||||||
|
Console.WriteLine(str.Reverse());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class StringExtensions
|
||||||
|
{
|
||||||
|
public static string Reverse(this string str)
|
||||||
|
{
|
||||||
|
char[] chars = str.ToCharArray();
|
||||||
|
Array.Reverse(chars);
|
||||||
|
return new string(chars);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This will print `!dlrow ,olleH` to the console. The `Reverse` method is defined in the `StringExtensions` class, yet is
|
||||||
|
called as if it were an instance method on the `str` variable, even though it's not.
|
||||||
|
|
||||||
|
### Why use extension methods?
|
||||||
|
|
||||||
|
Extension methods were introduced when LINQ was added to .NET. LINQ is a set of extension methods that provide a way to
|
||||||
|
query, filter, and transform data. If you were to access LINQ's methods statically, you would have to write code like
|
||||||
|
this:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
int[] numbers = { 1, 2, 3, 4, 5 };
|
||||||
|
IEnumerable<int> evenNumbers = Enumerable.Where(numbers, x => x % 2 == 0);
|
||||||
|
IEnumerable<int> doubledNumbers = Enumerable.Select(evenNumbers, x => x * 2);
|
||||||
|
int sum = Enumerable.Sum(doubledNumbers);
|
||||||
|
Console.WriteLine(sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And if you wanted to one-line this, you'd have to write this:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
int[] numbers = { 1, 2, 3, 4, 5 };
|
||||||
|
Console.WriteLine(Enumerable.Sum(Enumerable.Select(Enumerable.Where(numbers, x => x % 2 == 0), x => x * 2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a lot of code to write, and it's not very readable. The nested method calls make it incredibly difficult to
|
||||||
|
follow. However, because LINQ is implemented as extension methods, you can write the following code instead:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
int[] numbers = { 1, 2, 3, 4, 5 };
|
||||||
|
Console.WriteLine(numbers.Where(x => x % 2 == 0).Select(x => x * 2).Sum());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Because the methods are called as if they were instance methods on `IEnumerable<T>`, they can be chained together,
|
||||||
|
making the code much more readable.
|
||||||
|
|
||||||
|
X10D aims to provide these same benefits as LINQ, but for dozens of other types and for countless other use cases. See
|
||||||
|
the [documentation](#documentation) for a complete breakdown of what's available.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### NuGet installation
|
### NuGet installation
|
||||||
|
|
||||||
```ps
|
```ps
|
||||||
Install-Package X10D -Version 4.0.0
|
Install-Package X10D -Version 4.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manual installation
|
### Manual installation
|
||||||
|
|
||||||
Download the [latest release](https://github.com/oliverbooth/X10D/releases/latest) from this repository and adding a direct assembly reference for your chosen platform.
|
Download the [latest release](https://github.com/oliverbooth/X10D/releases/latest) from this repository and adding a direct assembly reference for your chosen platform.
|
||||||
|
|
||||||
### Unity installation
|
## Documentation
|
||||||
For the Unity installation guide, refer to the [README.md in X10D.Unity](X10D.Unity/README.md).
|
|
||||||
|
|
||||||
## Features
|
Documentation and the API reference is available at https://oliverbooth.github.io/X10D/index.html. *I'm sorry this took
|
||||||
I'm planning on writing complete and extensive documentation in the near future. As of this time, feel free to browse the source or the API using your favourite IDE.
|
so long to get up and running. DocFX will be the death of me.*
|
||||||
For those familiar with the 2.6.0 API, please read [CHANGELOG.md](CHANGELOG.md) for a complete list of changes. **3.0.0 is a major release and introduces many breaking changes.**
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
X10D is released under the MIT License. See [here](https://github.com/oliverbooth/X10D/blob/main/LICENSE.md) for more details.
|
X10D is released under the MIT License. See [here](https://github.com/oliverbooth/X10D/blob/main/LICENSE.md) for more details.
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0"/>
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net7.0;net6.0;netcoreapp3.1</TargetFrameworks>
|
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
<CoverletOutputFormat>json,cobertura</CoverletOutputFormat>
|
<CoverletOutputFormat>json,cobertura</CoverletOutputFormat>
|
||||||
<CollectCoverage>true</CollectCoverage>
|
<CollectCoverage>true</CollectCoverage>
|
||||||
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
|
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
|
||||||
@ -13,14 +14,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0"/>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
|
||||||
<PackageReference Include="NSubstitute" Version="5.0.0"/>
|
<PackageReference Include="NSubstitute" Version="5.1.0"/>
|
||||||
<PackageReference Include="NUnit" Version="3.13.3"/>
|
<PackageReference Include="NUnit" Version="3.14.0"/>
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2"/>
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>
|
||||||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"/>
|
<PackageReference Include="NUnit.Analyzers" Version="3.9.0"/>
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0"/>
|
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
|
||||||
<PackageReference Include="System.Reactive" Version="5.0.0"/>
|
<PackageReference Include="System.Reactive" Version="6.0.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -47,7 +47,6 @@ internal class ByteTests
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnpackInternal_Fallback_ShouldUnpackToSpanCorrectly()
|
public void UnpackInternal_Fallback_ShouldUnpackToSpanCorrectly()
|
||||||
{
|
{
|
||||||
@ -92,7 +91,6 @@ internal class ByteTests
|
|||||||
Assert.That(bits[7], Is.True);
|
Assert.That(bits[7], Is.True);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Unpack_ShouldRepackEqually()
|
public void Unpack_ShouldRepackEqually()
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#if NET5_0_OR_GREATER
|
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
#endif
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Collections;
|
using X10D.Collections;
|
||||||
|
|
||||||
@ -84,7 +82,6 @@ internal class Int16Tests
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnpackInternal_Ssse3_ShouldUnpackToSpanCorrectly()
|
public void UnpackInternal_Ssse3_ShouldUnpackToSpanCorrectly()
|
||||||
{
|
{
|
||||||
@ -115,7 +112,6 @@ internal class Int16Tests
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Unpack_ShouldRepackEqually()
|
public void Unpack_ShouldRepackEqually()
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#if NET5_0_OR_GREATER
|
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
#endif
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Collections;
|
using X10D.Collections;
|
||||||
|
|
||||||
@ -85,7 +83,6 @@ internal class Int32Tests
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnpackInternal_Ssse3_ShouldUnpackToSpanCorrectly()
|
public void UnpackInternal_Ssse3_ShouldUnpackToSpanCorrectly()
|
||||||
{
|
{
|
||||||
@ -145,7 +142,6 @@ internal class Int32Tests
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Unpack_ShouldRepackEqually()
|
public void Unpack_ShouldRepackEqually()
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#if NET6_0_OR_GREATER
|
|
||||||
using System.Runtime.Intrinsics;
|
using System.Runtime.Intrinsics;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -223,4 +222,3 @@ internal class IntrinsicTests
|
|||||||
Assert.That(result, Is.EqualTo(expectedResult));
|
Assert.That(result, Is.EqualTo(expectedResult));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#if NET5_0_OR_GREATER
|
|
||||||
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.Arm;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
#endif
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Core;
|
using X10D.Core;
|
||||||
|
|
||||||
@ -209,7 +207,6 @@ internal class SpanTest
|
|||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackByteInternal_Sse2_ShouldReturnCorrectByte_GivenReadOnlySpan_Using()
|
public void PackByteInternal_Sse2_ShouldReturnCorrectByte_GivenReadOnlySpan_Using()
|
||||||
{
|
{
|
||||||
@ -226,23 +223,6 @@ internal class SpanTest
|
|||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void PackByteInternal_AdvSimd_ShouldReturnCorrectByte_GivenReadOnlySpan_Using()
|
|
||||||
{
|
|
||||||
if (!AdvSimd.IsSupported)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const byte expected = 0b00110011;
|
|
||||||
ReadOnlySpan<bool> span = stackalloc bool[8] {true, true, false, false, true, true, false, false};
|
|
||||||
|
|
||||||
byte actual = span.PackByteInternal_AdvSimd();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackInt16_ShouldReturnSameAsPackByte_WhenSpanHasLength8()
|
public void PackInt16_ShouldReturnSameAsPackByte_WhenSpanHasLength8()
|
||||||
{
|
{
|
||||||
@ -268,7 +248,6 @@ internal class SpanTest
|
|||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackInt16Internal_Sse2_ShouldReturnCorrectInt16_GivenReadOnlySpan_Using()
|
public void PackInt16Internal_Sse2_ShouldReturnCorrectInt16_GivenReadOnlySpan_Using()
|
||||||
{
|
{
|
||||||
@ -287,7 +266,6 @@ internal class SpanTest
|
|||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackInt32Internal_Fallback_ShouldReturnCorrectInt32_GivenReadOnlySpan()
|
public void PackInt32Internal_Fallback_ShouldReturnCorrectInt32_GivenReadOnlySpan()
|
||||||
@ -304,7 +282,6 @@ internal class SpanTest
|
|||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackInt32Internal_Sse2_ShouldReturnCorrectInt32_GivenReadOnlySpan()
|
public void PackInt32Internal_Sse2_ShouldReturnCorrectInt32_GivenReadOnlySpan()
|
||||||
{
|
{
|
||||||
@ -345,27 +322,6 @@ internal class SpanTest
|
|||||||
Assert.That(actual, Is.EqualTo(expected));
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void PackInt32Internal_AdvSimd_ShouldReturnCorrectInt32_GivenReadOnlySpan()
|
|
||||||
{
|
|
||||||
if (!AdvSimd.IsSupported)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int expected = 0b01010101_10101010_01010101_10101010;
|
|
||||||
ReadOnlySpan<bool> span = stackalloc bool[32]
|
|
||||||
{
|
|
||||||
false, true, false, true, false, true, false, true, true, false, true, false, true, false, true, false, false,
|
|
||||||
true, false, true, false, true, false, true, true, false, true, false, true, false, true, false,
|
|
||||||
};
|
|
||||||
|
|
||||||
int actual = span.PackInt32Internal_AdvSimd();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PackInt32_ShouldReturnSameAsPackByte_WhenSpanHasLength8_UsingReadOnlySpan()
|
public void PackInt32_ShouldReturnSameAsPackByte_WhenSpanHasLength8_UsingReadOnlySpan()
|
||||||
{
|
{
|
||||||
|
@ -207,9 +207,7 @@ internal class ColorTests
|
|||||||
Assert.That(Color.Plum.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
Assert.That(Color.Plum.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
||||||
Assert.That(Color.PowderBlue.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
Assert.That(Color.PowderBlue.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
||||||
Assert.That(Color.Purple.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkMagenta));
|
Assert.That(Color.Purple.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkMagenta));
|
||||||
#if NET6_0_OR_GREATER
|
|
||||||
Assert.That(Color.RebeccaPurple.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkMagenta));
|
Assert.That(Color.RebeccaPurple.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkMagenta));
|
||||||
#endif
|
|
||||||
Assert.That(Color.Red.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Red));
|
Assert.That(Color.Red.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Red));
|
||||||
Assert.That(Color.RosyBrown.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
Assert.That(Color.RosyBrown.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkGray));
|
||||||
Assert.That(Color.RoyalBlue.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkCyan));
|
Assert.That(Color.RoyalBlue.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.DarkCyan));
|
||||||
|
@ -33,7 +33,7 @@ internal class DoubleTests
|
|||||||
|
|
||||||
var expected = new byte[] { 0x40, 0x45, 0x40, 0, 0, 0, 0, 0 };
|
var expected = new byte[] { 0x40, 0x45, 0x40, 0, 0, 0, 0, 0 };
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ internal class DoubleTests
|
|||||||
|
|
||||||
var expected = new byte[] { 0, 0, 0, 0, 0, 0x40, 0x45, 0x40 };
|
var expected = new byte[] { 0, 0, 0, 0, 0, 0x40, 0x45, 0x40 };
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ internal class DoubleTests
|
|||||||
{
|
{
|
||||||
const double value = 42.5;
|
const double value = 42.5;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,6 +61,6 @@ internal class DoubleTests
|
|||||||
{
|
{
|
||||||
const double value = 42.5;
|
const double value = 42.5;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class Int16Tests
|
|||||||
|
|
||||||
byte[] expected = { 0x0F, 0 };
|
byte[] expected = { 0x0F, 0 };
|
||||||
Span<byte> actual = stackalloc byte[2];
|
Span<byte> actual = stackalloc byte[2];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ internal class Int16Tests
|
|||||||
|
|
||||||
byte[] expected = { 0, 0x0F };
|
byte[] expected = { 0, 0x0F };
|
||||||
Span<byte> actual = stackalloc byte[2];
|
Span<byte> actual = stackalloc byte[2];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ internal class Int16Tests
|
|||||||
{
|
{
|
||||||
const short value = 0x0F;
|
const short value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,6 +61,6 @@ internal class Int16Tests
|
|||||||
{
|
{
|
||||||
const short value = 0x0F;
|
const short value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class Int32Tests
|
|||||||
|
|
||||||
var expected = new byte[] { 0, 0, 0, 0x0F };
|
var expected = new byte[] { 0, 0, 0, 0x0F };
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ internal class Int32Tests
|
|||||||
|
|
||||||
var expected = new byte[] { 0x0F, 0, 0, 0 };
|
var expected = new byte[] { 0x0F, 0, 0, 0 };
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ internal class Int32Tests
|
|||||||
{
|
{
|
||||||
const int value = 0x0F;
|
const int value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,6 +61,6 @@ internal class Int32Tests
|
|||||||
{
|
{
|
||||||
const int value = 0x0F;
|
const int value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class Int64Tests
|
|||||||
|
|
||||||
byte[] expected = { 0x0F, 0, 0, 0, 0, 0, 0, 0 };
|
byte[] expected = { 0x0F, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ internal class Int64Tests
|
|||||||
|
|
||||||
byte[] expected = { 0, 0, 0, 0, 0, 0, 0, 0x0F };
|
byte[] expected = { 0, 0, 0, 0, 0, 0, 0, 0x0F };
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ internal class Int64Tests
|
|||||||
{
|
{
|
||||||
const long value = 0x0F;
|
const long value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,6 +61,6 @@ internal class Int64Tests
|
|||||||
{
|
{
|
||||||
const long value = 0x0F;
|
const long value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class SingleTests
|
|||||||
|
|
||||||
var expected = new byte[] { 0x42, 0x2A, 0, 0 };
|
var expected = new byte[] { 0x42, 0x2A, 0, 0 };
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ internal class SingleTests
|
|||||||
|
|
||||||
var expected = new byte[] { 0, 0, 0x2A, 0x42 };
|
var expected = new byte[] { 0, 0, 0x2A, 0x42 };
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ internal class SingleTests
|
|||||||
{
|
{
|
||||||
const float value = 42.5f;
|
const float value = 42.5f;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -61,6 +61,6 @@ internal class SingleTests
|
|||||||
{
|
{
|
||||||
const float value = 42.5f;
|
const float value = 42.5f;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class UInt16Tests
|
|||||||
byte[] expected = { 0x0F, 0 };
|
byte[] expected = { 0x0F, 0 };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[2];
|
Span<byte> actual = stackalloc byte[2];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ internal class UInt16Tests
|
|||||||
byte[] expected = { 0, 0x0F };
|
byte[] expected = { 0, 0x0F };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[2];
|
Span<byte> actual = stackalloc byte[2];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ internal class UInt16Tests
|
|||||||
{
|
{
|
||||||
const ushort value = 0x0F;
|
const ushort value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -63,6 +63,6 @@ internal class UInt16Tests
|
|||||||
{
|
{
|
||||||
const ushort value = 0x0F;
|
const ushort value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class UInt32Tests
|
|||||||
byte[] expected = { 0x0F, 0, 0, 0 };
|
byte[] expected = { 0x0F, 0, 0, 0 };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ internal class UInt32Tests
|
|||||||
byte[] expected = { 0, 0, 0, 0x0F };
|
byte[] expected = { 0, 0, 0, 0x0F };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[4];
|
Span<byte> actual = stackalloc byte[4];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ internal class UInt32Tests
|
|||||||
{
|
{
|
||||||
const uint value = 0x0F;
|
const uint value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -63,6 +63,6 @@ internal class UInt32Tests
|
|||||||
{
|
{
|
||||||
const uint value = 0x0F;
|
const uint value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ internal class UInt64Tests
|
|||||||
byte[] expected = { 0x0F, 0, 0, 0, 0, 0, 0, 0 };
|
byte[] expected = { 0x0F, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteLittleEndian(actual));
|
Assert.That(value.TryWriteLittleEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ internal class UInt64Tests
|
|||||||
byte[] expected = { 0, 0, 0, 0, 0, 0, 0, 0x0F };
|
byte[] expected = { 0, 0, 0, 0, 0, 0, 0, 0x0F };
|
||||||
|
|
||||||
Span<byte> actual = stackalloc byte[8];
|
Span<byte> actual = stackalloc byte[8];
|
||||||
Assert.That(value.TryWriteBigEndian(actual));
|
Assert.That(value.TryWriteBigEndianBytes(actual));
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, actual.ToArray());
|
CollectionAssert.AreEqual(expected, actual.ToArray());
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ internal class UInt64Tests
|
|||||||
{
|
{
|
||||||
const ulong value = 0x0F;
|
const ulong value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteLittleEndian(buffer), Is.False);
|
Assert.That(value.TryWriteLittleEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -63,6 +63,6 @@ internal class UInt64Tests
|
|||||||
{
|
{
|
||||||
const ulong value = 0x0F;
|
const ulong value = 0x0F;
|
||||||
Span<byte> buffer = stackalloc byte[0];
|
Span<byte> buffer = stackalloc byte[0];
|
||||||
Assert.That(value.TryWriteBigEndian(buffer), Is.False);
|
Assert.That(value.TryWriteBigEndianBytes(buffer), Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ internal class ReadOnlySpanTests
|
|||||||
Assert.Throws<ArgumentNullException>(() =>
|
Assert.Throws<ArgumentNullException>(() =>
|
||||||
{
|
{
|
||||||
var span = new ReadOnlySpan<int>();
|
var span = new ReadOnlySpan<int>();
|
||||||
_ = span.Count(null!);
|
_ = span.Count((Predicate<int>)null!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ internal class SpanTests
|
|||||||
Assert.Throws<ArgumentNullException>(() =>
|
Assert.Throws<ArgumentNullException>(() =>
|
||||||
{
|
{
|
||||||
var span = new Span<int>();
|
var span = new Span<int>();
|
||||||
_ = span.Count(null!);
|
_ = span.Count((Predicate<int>)null!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,60 @@ internal class CharSpanTests
|
|||||||
Assert.That(string.Empty.AsSpan().CountSubstring('\0'), Is.Zero);
|
Assert.That(string.Empty.AsSpan().CountSubstring('\0'), Is.Zero);
|
||||||
Assert.That(string.Empty.AsSpan().CountSubstring(string.Empty.AsSpan(), StringComparison.OrdinalIgnoreCase), Is.Zero);
|
Assert.That(string.Empty.AsSpan().CountSubstring(string.Empty.AsSpan(), StringComparison.OrdinalIgnoreCase), Is.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldNotManipulateSpan_GivenCount0()
|
||||||
|
{
|
||||||
|
Span<char> destination = new char[11];
|
||||||
|
"Hello world".AsSpan().CopyTo(destination);
|
||||||
|
|
||||||
|
"a".AsSpan().Repeat(0, destination);
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo("Hello world"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldReturnItself_GivenCount1()
|
||||||
|
{
|
||||||
|
string repeated = "a".AsSpan().Repeat(1);
|
||||||
|
Assert.That(repeated, Has.Length.EqualTo(1));
|
||||||
|
Assert.That(repeated, Is.EqualTo("a"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldPopulateSpan_GivenValidSpan()
|
||||||
|
{
|
||||||
|
const string expected = "aaaaaaaaaa";
|
||||||
|
Span<char> destination = new char[10];
|
||||||
|
"a".AsSpan().Repeat(10, destination);
|
||||||
|
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldReturnEmptyString_GivenCount0()
|
||||||
|
{
|
||||||
|
Assert.That("a".AsSpan().Repeat(0), Is.EqualTo(string.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldReturnRepeatedString_GivenSpan()
|
||||||
|
{
|
||||||
|
const string expected = "aaaaaaaaaa";
|
||||||
|
string actual = "a".AsSpan().Repeat(10);
|
||||||
|
|
||||||
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldThrowArgumentException_GivenSmallSpan()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>(() => "a".AsSpan().Repeat(10, Span<char>.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldThrowArgumentOutOfRangeException_GivenNegativeCount()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => _ = "a".AsSpan().Repeat(-1));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => "a".AsSpan().Repeat(-1, Span<char>.Empty));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,15 @@ internal class CharTests
|
|||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void IsEmoji_ShouldReturnTrue_GivenBasicEmoji()
|
public void IsEmoji_ShouldReturnTrue_GivenBasicEmoji()
|
||||||
|
{
|
||||||
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That('✂'.IsEmoji());
|
Assert.That('✂'.IsEmoji());
|
||||||
Assert.That('✅'.IsEmoji());
|
Assert.That('✅'.IsEmoji());
|
||||||
Assert.That('❎'.IsEmoji());
|
Assert.That('❎'.IsEmoji());
|
||||||
Assert.That('➕'.IsEmoji());
|
Assert.That('➕'.IsEmoji());
|
||||||
Assert.That('➖'.IsEmoji());
|
Assert.That('➖'.IsEmoji());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -26,7 +29,26 @@ internal class CharTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RepeatShouldBeCorrect()
|
public void Repeat_ShouldPopulateSpanWithRepeatedCharacter_GivenValidCount()
|
||||||
|
{
|
||||||
|
const string expected = "aaaaaaaaaa";
|
||||||
|
Span<char> destination = new char[10];
|
||||||
|
'a'.Repeat(10, destination);
|
||||||
|
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldOnlyWriteOneCharToSpan_GivenCount1()
|
||||||
|
{
|
||||||
|
Span<char> destination = new char[10];
|
||||||
|
'a'.Repeat(1, destination);
|
||||||
|
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo("a\0\0\0\0\0\0\0\0\0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldReturnRepeatedCharacter_GivenValidCount()
|
||||||
{
|
{
|
||||||
const string expected = "aaaaaaaaaa";
|
const string expected = "aaaaaaaaaa";
|
||||||
string actual = 'a'.Repeat(10);
|
string actual = 'a'.Repeat(10);
|
||||||
@ -35,22 +57,47 @@ internal class CharTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RepeatOneCountShouldBeLength1String()
|
public void Repeat_ShouldReturnSingleCharString_GivenCount1()
|
||||||
{
|
{
|
||||||
string repeated = 'a'.Repeat(1);
|
string repeated = 'a'.Repeat(1);
|
||||||
Assert.That(repeated.Length, Is.EqualTo(1));
|
Assert.That(repeated, Has.Length.EqualTo(1));
|
||||||
Assert.That(repeated, Is.EqualTo("a"));
|
Assert.That(repeated, Is.EqualTo("a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RepeatZeroCountShouldBeEmpty()
|
public void Repeat_ShouldReturnEmptyString_GivenCount0()
|
||||||
{
|
{
|
||||||
Assert.That('a'.Repeat(0), Is.EqualTo(string.Empty));
|
Assert.That('a'.Repeat(0), Is.EqualTo(string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RepeatNegativeCountShouldThrow()
|
public void Repeat_ShouldNotManipulateSpan_GivenCount0()
|
||||||
{
|
{
|
||||||
Assert.Throws<ArgumentOutOfRangeException>(() => 'a'.Repeat(-1));
|
Span<char> destination = new char[10];
|
||||||
|
destination.Fill(' ');
|
||||||
|
'a'.Repeat(0, destination);
|
||||||
|
|
||||||
|
const string expected = " ";
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldThrowArgumentOutOfRangeException_GivenNegativeCount()
|
||||||
|
{
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => _ = 'a'.Repeat(-1));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => 'a'.Repeat(-1, Span<char>.Empty));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldThrowArgumentException_GivenSmallSpan()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>(() =>
|
||||||
|
{
|
||||||
|
var destination = Span<char>.Empty;
|
||||||
|
'a'.Repeat(1, destination);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ namespace X10D.Tests.Text;
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
internal class CoreTests
|
internal class CoreTests
|
||||||
{
|
{
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ToJsonShouldNotBeEmpty()
|
public void ToJsonShouldNotBeEmpty()
|
||||||
{
|
{
|
||||||
@ -24,5 +23,4 @@ internal class CoreTests
|
|||||||
CollectionAssert.AreEqual(source, target);
|
CollectionAssert.AreEqual(source, target);
|
||||||
CollectionAssert.AreEquivalent(source, target);
|
CollectionAssert.AreEquivalent(source, target);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
171
X10D.Tests/src/Text/MarkdownTests.cs
Normal file
171
X10D.Tests/src/Text/MarkdownTests.cs
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using X10D.Text;
|
||||||
|
|
||||||
|
namespace X10D.Tests.Text;
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
internal class MarkdownTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void MDBold_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDBold());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDBold_ShouldReturnBoldText_GivenText()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDBold(), Is.EqualTo("**Hello, world!**"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDCode_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDCode_ShouldReturnCodeText_GivenText()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDCode(), Is.EqualTo("`Hello, world!`"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDCodeBlock_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDCodeBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDCodeBlock_ShouldReturnCodeBlockText_GivenText()
|
||||||
|
{
|
||||||
|
var expected = $"```{Environment.NewLine}Hello, world!{Environment.NewLine}```";
|
||||||
|
string actual = "Hello, world!".MDCodeBlock();
|
||||||
|
|
||||||
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDCodeBlock_ShouldReturnCodeBlockText_GivenTextAndLanguage()
|
||||||
|
{
|
||||||
|
var expected = $"```csharp{Environment.NewLine}Hello, world!{Environment.NewLine}```";
|
||||||
|
string actual = "Hello, world!".MDCodeBlock("csharp");
|
||||||
|
|
||||||
|
Assert.That(actual, Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDHeading_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDHeading(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDHeading_ShouldThrowArgumentOutOfRangeException_GivenInvalidHeading()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => "Hello, world!".MDHeading(0));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => "Hello, world!".MDHeading(7));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDHeading_ShouldReturnHeadingText_GivenText()
|
||||||
|
{
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDHeading(1), Is.EqualTo("# Hello, world!"));
|
||||||
|
Assert.That("Hello, world!".MDHeading(2), Is.EqualTo("## Hello, world!"));
|
||||||
|
Assert.That("Hello, world!".MDHeading(3), Is.EqualTo("### Hello, world!"));
|
||||||
|
Assert.That("Hello, world!".MDHeading(4), Is.EqualTo("#### Hello, world!"));
|
||||||
|
Assert.That("Hello, world!".MDHeading(5), Is.EqualTo("##### Hello, world!"));
|
||||||
|
Assert.That("Hello, world!".MDHeading(6), Is.EqualTo("###### Hello, world!"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDItalic_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDItalic());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDItalic_ShouldReturnItalicTextWithAsterisk_GivenText()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDItalic(), Is.EqualTo("*Hello, world!*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDItalic_ShouldReturnItalicTextWithAsterisk_GivenText_AndFalseUnderscoreFlag()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDItalic(false), Is.EqualTo("*Hello, world!*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDItalic_ShouldReturnItalicTextWithUnderscores_GivenText_AndTrueUnderscoreFlag()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDItalic(true), Is.EqualTo("_Hello, world!_"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDLink_ShouldThrowArgumentNullException_GivenNullUrl()
|
||||||
|
{
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => "".MDLink((string)null!));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => "".MDLink((Uri)null!));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((Uri)null!).MDLink("Hello, world!"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDLink_ShouldReturnUrlOnly_GivenNullOrEmptyLabel()
|
||||||
|
{
|
||||||
|
const string url = "https://example.com/";
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(((string)null!).MDLink(url), Is.EqualTo(url));
|
||||||
|
Assert.That(string.Empty.MDLink(url), Is.EqualTo(url));
|
||||||
|
|
||||||
|
Assert.That(new Uri(url).MDLink(null), Is.EqualTo(url));
|
||||||
|
Assert.That(new Uri(url).MDLink(string.Empty), Is.EqualTo(url));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDLink_ShouldReturnFormattedLink_GivenValidLabelAndUrl()
|
||||||
|
{
|
||||||
|
const string url = "https://example.com/";
|
||||||
|
const string label = "Hello, world!";
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(label.MDLink(url), Is.EqualTo($"[{label}]({url})"));
|
||||||
|
Assert.That(label.MDLink(new Uri(url)), Is.EqualTo($"[{label}]({url})"));
|
||||||
|
|
||||||
|
Assert.That(new Uri(url).MDLink(label), Is.EqualTo($"[{label}]({url})"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDStrikeOut_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDStrikeOut());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDStrikeOut_ShouldReturnStrikeOutText_GivenText()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDStrikeOut(), Is.EqualTo("~~Hello, world!~~"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDUnderline_ShouldThrowArgumentNullException_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentNullException>(() => ((string)null!).MDUnderline());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MDUnderline_ShouldReturnUnderlineText_GivenText()
|
||||||
|
{
|
||||||
|
Assert.That("Hello, world!".MDUnderline(), Is.EqualTo("__Hello, world!__"));
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,3 @@
|
|||||||
#if NET5_0_OR_GREATER
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Text;
|
using X10D.Text;
|
||||||
@ -90,4 +89,3 @@ internal class RuneTests
|
|||||||
Assert.That(repeated, Is.EqualTo("𐀀𐀀𐀀𐀀𐀀𐀀"));
|
Assert.That(repeated, Is.EqualTo("𐀀𐀀𐀀𐀀𐀀𐀀"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
#endif
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Text;
|
using X10D.Text;
|
||||||
|
|
||||||
@ -164,7 +162,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('E'), Is.Zero);
|
Assert.That("Hello World".CountSubstring('E'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("E"), Is.Zero);
|
Assert.That("Hello World".CountSubstring("E"), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("E", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("E", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -175,7 +175,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('z'), Is.Zero);
|
Assert.That("Hello World".CountSubstring('z'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("z"), Is.Zero);
|
Assert.That("Hello World".CountSubstring("z"), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("z", StringComparison.OrdinalIgnoreCase), Is.Zero);
|
Assert.That("Hello World".CountSubstring("z", StringComparison.OrdinalIgnoreCase), Is.Zero);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -186,7 +188,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That("Hello World".CountSubstring('e'), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring('e'), Is.EqualTo(1));
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That("Hello World".CountSubstring("e"), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("e"), Is.EqualTo(1));
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That("Hello World".CountSubstring("e", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
Assert.That("Hello World".CountSubstring("e", StringComparison.OrdinalIgnoreCase), Is.EqualTo(1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -197,7 +201,9 @@ internal class StringTests
|
|||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That(string.Empty.CountSubstring('\0'), Is.Zero);
|
Assert.That(string.Empty.CountSubstring('\0'), Is.Zero);
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.CountSubstring(string.Empty), Is.Zero);
|
Assert.That(string.Empty.CountSubstring(string.Empty), Is.Zero);
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.That(string.Empty.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase), Is.Zero);
|
Assert.That(string.Empty.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase), Is.Zero);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -207,7 +213,9 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
string value = null!;
|
string value = null!;
|
||||||
Assert.Throws<ArgumentNullException>(() => value.CountSubstring('\0'));
|
Assert.Throws<ArgumentNullException>(() => value.CountSubstring('\0'));
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.Throws<ArgumentNullException>(() => value.CountSubstring(string.Empty));
|
Assert.Throws<ArgumentNullException>(() => value.CountSubstring(string.Empty));
|
||||||
|
#pragma warning restore CA1307
|
||||||
Assert.Throws<ArgumentNullException>(() => value.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase));
|
Assert.Throws<ArgumentNullException>(() => value.CountSubstring(string.Empty, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +225,10 @@ internal class StringTests
|
|||||||
const string value = "Hello Worl";
|
const string value = "Hello Worl";
|
||||||
const char substring = 'd';
|
const char substring = 'd';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -226,7 +237,10 @@ internal class StringTests
|
|||||||
const string value = "A";
|
const string value = "A";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo(value));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo(value));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -235,7 +249,10 @@ internal class StringTests
|
|||||||
const string value = "B";
|
const string value = "B";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("AB"));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("AB"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo("AB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -244,7 +261,10 @@ internal class StringTests
|
|||||||
const string value = "A";
|
const string value = "A";
|
||||||
const char substring = 'A';
|
const char substring = 'A';
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo(value));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo(value));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -253,7 +273,10 @@ internal class StringTests
|
|||||||
const string value = "Hello ";
|
const string value = "Hello ";
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureEndsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -261,7 +284,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureEndsWith(substring), Is.EqualTo(substring));
|
Assert.That(substring.EnsureEndsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -269,7 +295,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.EnsureEndsWith(substring), Is.EqualTo(substring));
|
Assert.That(string.Empty.EnsureEndsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(string.Empty.EnsureEndsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -277,7 +306,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureEndsWith(string.Empty), Is.EqualTo(substring));
|
Assert.That(substring.EnsureEndsWith(string.Empty), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureEndsWith(string.Empty, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -286,7 +318,10 @@ internal class StringTests
|
|||||||
const string value = "World";
|
const string value = "World";
|
||||||
const string substring = "Hello ";
|
const string substring = "Hello ";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("Hello World"));
|
Assert.That(value.EnsureStartsWith(substring), Is.EqualTo("Hello World"));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(value.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo("Hello World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -294,7 +329,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureStartsWith(substring), Is.EqualTo(substring));
|
Assert.That(substring.EnsureStartsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -302,7 +340,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(string.Empty.EnsureStartsWith(substring), Is.EqualTo(substring));
|
Assert.That(string.Empty.EnsureStartsWith(substring), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(string.Empty.EnsureStartsWith(substring, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -310,7 +351,10 @@ internal class StringTests
|
|||||||
{
|
{
|
||||||
const string substring = "World";
|
const string substring = "World";
|
||||||
|
|
||||||
|
#pragma warning disable CA1307
|
||||||
Assert.That(substring.EnsureStartsWith(string.Empty), Is.EqualTo(substring));
|
Assert.That(substring.EnsureStartsWith(string.Empty), Is.EqualTo(substring));
|
||||||
|
#pragma warning restore CA1307
|
||||||
|
Assert.That(substring.EnsureStartsWith(string.Empty, StringComparison.Ordinal), Is.EqualTo(substring));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -372,7 +416,6 @@ internal class StringTests
|
|||||||
Assert.Throws<ArgumentException>(() => _ = " ".EnumParse<DayOfWeek>());
|
Assert.Throws<ArgumentException>(() => _ = " ".EnumParse<DayOfWeek>());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
[Test]
|
[Test]
|
||||||
public void FromJson_ShouldDeserializeCorrectly_GivenJsonString()
|
public void FromJson_ShouldDeserializeCorrectly_GivenJsonString()
|
||||||
{
|
{
|
||||||
@ -388,7 +431,6 @@ internal class StringTests
|
|||||||
Assert.That(target.Values[2], Is.EqualTo(3));
|
Assert.That(target.Values[2], Is.EqualTo(3));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetBytes_ShouldReturnUtf8Bytes_GivenHelloWorld()
|
public void GetBytes_ShouldReturnUtf8Bytes_GivenHelloWorld()
|
||||||
@ -448,12 +490,14 @@ internal class StringTests
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
for (var i = 0; i < 26; i++)
|
for (var i = 0; i < 26; i++)
|
||||||
|
{
|
||||||
for (var j = 0; j < 26; j++)
|
for (var j = 0; j < 26; j++)
|
||||||
{
|
{
|
||||||
string flag = (regionalIndicatorCodes[i] + regionalIndicatorCodes[j]);
|
string flag = (regionalIndicatorCodes[i] + regionalIndicatorCodes[j]);
|
||||||
Assert.That(flag.IsEmoji());
|
Assert.That(flag.IsEmoji());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void IsEmoji_ShouldReturnFalse_GivenNonEmoji()
|
public void IsEmoji_ShouldReturnFalse_GivenNonEmoji()
|
||||||
@ -696,7 +740,7 @@ internal class StringTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void Randomize_ShouldThrow_GivenNegativeLength()
|
public void Randomize_ShouldThrow_GivenNegativeLength()
|
||||||
{
|
{
|
||||||
Assert.Throws<ArgumentOutOfRangeException>(() => string.Empty.Randomize(-1));
|
Assert.Throws<ArgumentOutOfRangeException>(() => _ = string.Empty.Randomize(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -714,25 +758,62 @@ internal class StringTests
|
|||||||
Assert.That("a".Repeat(0), Is.EqualTo(string.Empty));
|
Assert.That("a".Repeat(0), Is.EqualTo(string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldNotManipulateSpan_GivenCount0()
|
||||||
|
{
|
||||||
|
Span<char> destination = new char[11];
|
||||||
|
"Hello world".AsSpan().CopyTo(destination);
|
||||||
|
|
||||||
|
"a".Repeat(0, destination);
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo("Hello world"));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Repeat_ShouldReturnItself_GivenCount1()
|
public void Repeat_ShouldReturnItself_GivenCount1()
|
||||||
{
|
{
|
||||||
string repeated = "a".Repeat(1);
|
string repeated = "a".Repeat(1);
|
||||||
Assert.That(repeated.Length, Is.EqualTo(1));
|
Assert.That(repeated, Has.Length.EqualTo(1));
|
||||||
Assert.That(repeated, Is.EqualTo("a"));
|
Assert.That(repeated, Is.EqualTo("a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Repeat_ShouldThrow_GivenNegativeCount()
|
public void Repeat_ShouldThrowArgumentException_GivenSmallSpan()
|
||||||
{
|
{
|
||||||
Assert.Throws<ArgumentOutOfRangeException>(() => _ = "a".Repeat(-1));
|
Assert.Throws<ArgumentException>(() => "a".Repeat(10, Span<char>.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Repeat_ShouldThrow_GivenNull()
|
public void Repeat_ShouldThrowArgumentOutOfRangeException_GivenNegativeCount()
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => _ = "a".Repeat(-1));
|
||||||
|
Assert.Throws<ArgumentOutOfRangeException>(() => "a".Repeat(-1, Span<char>.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldThrowArgumentNullException_GivenNull()
|
||||||
{
|
{
|
||||||
string value = null!;
|
string value = null!;
|
||||||
Assert.Throws<ArgumentNullException>(() => _ = value.Repeat(0));
|
Assert.Throws<ArgumentNullException>(() => _ = value.Repeat(0));
|
||||||
|
Assert.Throws<ArgumentNullException>(() => value.Repeat(0, Span<char>.Empty));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldPopulateSpanWithRepeatedCharacter_GivenValidCount()
|
||||||
|
{
|
||||||
|
const string expected = "aaaaaaaaaa";
|
||||||
|
Span<char> destination = new char[10];
|
||||||
|
"a".Repeat(10, destination);
|
||||||
|
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Repeat_ShouldOnlyWriteOneCharToSpan_GivenCount1()
|
||||||
|
{
|
||||||
|
Span<char> destination = new char[10];
|
||||||
|
"a".Repeat(1, destination);
|
||||||
|
|
||||||
|
Assert.That(destination.ToString(), Is.EqualTo("a\0\0\0\0\0\0\0\0\0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -751,7 +832,7 @@ internal class StringTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Reverse_ShouldThrow_GivenNull()
|
public void Reverse_ShouldThrowArgumentNullException_GivenNull()
|
||||||
{
|
{
|
||||||
string value = null!;
|
string value = null!;
|
||||||
Assert.Throws<ArgumentNullException>(() => _ = value.Reverse());
|
Assert.Throws<ArgumentNullException>(() => _ = value.Reverse());
|
||||||
@ -769,7 +850,7 @@ internal class StringTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Shuffled_ShouldThrow_GivenNull()
|
public void Shuffled_ShouldThrowArgumentNullException_GivenNull()
|
||||||
{
|
{
|
||||||
string value = null!;
|
string value = null!;
|
||||||
Assert.Throws<ArgumentNullException>(() => _ = value.Shuffled());
|
Assert.Throws<ArgumentNullException>(() => _ = value.Shuffled());
|
||||||
@ -803,7 +884,7 @@ internal class StringTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Split_ShouldThrow_GivenNullString()
|
public void Split_ShouldThrowArgumentNullException_GivenNullString()
|
||||||
{
|
{
|
||||||
string value = null!;
|
string value = null!;
|
||||||
|
|
||||||
@ -921,11 +1002,9 @@ internal class StringTests
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET5_0_OR_GREATER
|
|
||||||
private struct SampleStructure
|
private struct SampleStructure
|
||||||
{
|
{
|
||||||
[JsonPropertyName("values")]
|
[JsonPropertyName("values")]
|
||||||
public int[] Values { get; set; }
|
public int[] Values { get; set; }
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#if NET6_0_OR_GREATER
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Time;
|
using X10D.Time;
|
||||||
|
|
||||||
@ -230,4 +229,3 @@ internal class DateOnlyTests
|
|||||||
Assert.That(date.ToUnixTimeSeconds(time), Is.EqualTo(946684800));
|
Assert.That(date.ToUnixTimeSeconds(time), Is.EqualTo(946684800));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#if NET5_0_OR_GREATER
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using X10D.Time;
|
using X10D.Time;
|
||||||
|
|
||||||
@ -52,4 +51,3 @@ internal class DoubleTests
|
|||||||
Assert.That((_negativeOne).Weeks() < TimeSpan.Zero);
|
Assert.That((_negativeOne).Weeks() < TimeSpan.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
72
X10D.Unity.Tests/.gitignore
vendored
72
X10D.Unity.Tests/.gitignore
vendored
@ -1,72 +0,0 @@
|
|||||||
# This .gitignore file should be placed at the root of your Unity project directory
|
|
||||||
#
|
|
||||||
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
|
|
||||||
#
|
|
||||||
/[Ll]ibrary/
|
|
||||||
/[Tt]emp/
|
|
||||||
/[Oo]bj/
|
|
||||||
/[Bb]uild/
|
|
||||||
/[Bb]uilds/
|
|
||||||
/[Ll]ogs/
|
|
||||||
/[Uu]ser[Ss]ettings/
|
|
||||||
|
|
||||||
# MemoryCaptures can get excessive in size.
|
|
||||||
# They also could contain extremely sensitive data
|
|
||||||
/[Mm]emoryCaptures/
|
|
||||||
|
|
||||||
# Recordings can get excessive in size
|
|
||||||
/[Rr]ecordings/
|
|
||||||
|
|
||||||
# Uncomment this line if you wish to ignore the asset store tools plugin
|
|
||||||
# /[Aa]ssets/AssetStoreTools*
|
|
||||||
|
|
||||||
# Autogenerated Jetbrains Rider plugin
|
|
||||||
/[Aa]ssets/Plugins/Editor/JetBrains*
|
|
||||||
|
|
||||||
# Visual Studio cache directory
|
|
||||||
.vs/
|
|
||||||
|
|
||||||
# Gradle cache directory
|
|
||||||
.gradle/
|
|
||||||
|
|
||||||
# Autogenerated VS/MD/Consulo solution and project files
|
|
||||||
ExportedObj/
|
|
||||||
.consulo/
|
|
||||||
*.csproj
|
|
||||||
*.unityproj
|
|
||||||
*.sln
|
|
||||||
*.suo
|
|
||||||
*.tmp
|
|
||||||
*.user
|
|
||||||
*.userprefs
|
|
||||||
*.pidb
|
|
||||||
*.booproj
|
|
||||||
*.svd
|
|
||||||
*.pdb
|
|
||||||
*.mdb
|
|
||||||
*.opendb
|
|
||||||
*.VC.db
|
|
||||||
|
|
||||||
# Unity3D generated meta files
|
|
||||||
*.pidb.meta
|
|
||||||
*.pdb.meta
|
|
||||||
*.mdb.meta
|
|
||||||
|
|
||||||
# Unity3D generated file on crash reports
|
|
||||||
sysinfo.txt
|
|
||||||
|
|
||||||
# Builds
|
|
||||||
*.apk
|
|
||||||
*.aab
|
|
||||||
*.unitypackage
|
|
||||||
*.app
|
|
||||||
|
|
||||||
# Crashlytics generated file
|
|
||||||
crashlytics-build.properties
|
|
||||||
|
|
||||||
# Packed Addressables
|
|
||||||
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
|
|
||||||
|
|
||||||
# Temporary auto-generated Android Assets
|
|
||||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
|
||||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6ea315d0fd7389c41b19996891e99ae3
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,354 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!29 &1
|
|
||||||
OcclusionCullingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_OcclusionBakeSettings:
|
|
||||||
smallestOccluder: 5
|
|
||||||
smallestHole: 0.25
|
|
||||||
backfaceThreshold: 100
|
|
||||||
m_SceneGUID: 00000000000000000000000000000000
|
|
||||||
m_OcclusionCullingData: {fileID: 0}
|
|
||||||
--- !u!104 &2
|
|
||||||
RenderSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 9
|
|
||||||
m_Fog: 0
|
|
||||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
|
||||||
m_FogMode: 3
|
|
||||||
m_FogDensity: 0.01
|
|
||||||
m_LinearFogStart: 0
|
|
||||||
m_LinearFogEnd: 300
|
|
||||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
|
||||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
|
||||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
|
||||||
m_AmbientIntensity: 1
|
|
||||||
m_AmbientMode: 0
|
|
||||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
|
||||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_HaloStrength: 0.5
|
|
||||||
m_FlareStrength: 1
|
|
||||||
m_FlareFadeSpeed: 3
|
|
||||||
m_HaloTexture: {fileID: 0}
|
|
||||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_DefaultReflectionMode: 0
|
|
||||||
m_DefaultReflectionResolution: 128
|
|
||||||
m_ReflectionBounces: 1
|
|
||||||
m_ReflectionIntensity: 1
|
|
||||||
m_CustomReflection: {fileID: 0}
|
|
||||||
m_Sun: {fileID: 0}
|
|
||||||
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
|
||||||
--- !u!157 &3
|
|
||||||
LightmapSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 12
|
|
||||||
m_GIWorkflowMode: 1
|
|
||||||
m_GISettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
|
||||||
m_EnableBakedLightmaps: 1
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_LightmapEditorSettings:
|
|
||||||
serializedVersion: 12
|
|
||||||
m_Resolution: 2
|
|
||||||
m_BakeResolution: 40
|
|
||||||
m_AtlasSize: 1024
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 1
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAmbientOcclusion: 0
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_TextureCompression: 1
|
|
||||||
m_FinalGather: 0
|
|
||||||
m_FinalGatherFiltering: 1
|
|
||||||
m_FinalGatherRayCount: 256
|
|
||||||
m_ReflectionCompression: 2
|
|
||||||
m_MixedBakeMode: 2
|
|
||||||
m_BakeBackend: 1
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 512
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVREnvironmentSampleCount: 256
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_PVRFilteringMode: 1
|
|
||||||
m_PVRDenoiserTypeDirect: 1
|
|
||||||
m_PVRDenoiserTypeIndirect: 1
|
|
||||||
m_PVRDenoiserTypeAO: 1
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVREnvironmentMIS: 1
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 5
|
|
||||||
m_PVRFilteringGaussRadiusAO: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_LightingDataAsset: {fileID: 0}
|
|
||||||
m_LightingSettings: {fileID: 0}
|
|
||||||
--- !u!196 &4
|
|
||||||
NavMeshSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_BuildSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
agentTypeID: 0
|
|
||||||
agentRadius: 0.5
|
|
||||||
agentHeight: 2
|
|
||||||
agentSlope: 45
|
|
||||||
agentClimb: 0.4
|
|
||||||
ledgeDropHeight: 0
|
|
||||||
maxJumpAcrossDistance: 0
|
|
||||||
minRegionArea: 2
|
|
||||||
manualCellSize: 0
|
|
||||||
cellSize: 0.16666667
|
|
||||||
manualTileSize: 0
|
|
||||||
tileSize: 256
|
|
||||||
accuratePlacement: 0
|
|
||||||
maxJobWorkers: 0
|
|
||||||
preserveTilesOutsideBounds: 0
|
|
||||||
debug:
|
|
||||||
m_Flags: 0
|
|
||||||
m_NavMeshData: {fileID: 0}
|
|
||||||
--- !u!1 &192863441
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 192863443}
|
|
||||||
- component: {fileID: 192863442}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: GameObject
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!114 &192863442
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 192863441}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 0fac6b15ed0b420ba300fc1ac10ef01a, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
_hexagonPoints:
|
|
||||||
- {x: -0.5, y: 0.5}
|
|
||||||
- {x: -0.25, y: 1}
|
|
||||||
- {x: 0.25, y: 1}
|
|
||||||
- {x: 0.5, y: 0.5}
|
|
||||||
- {x: 0.25, y: 0}
|
|
||||||
- {x: -0.25, y: 0}
|
|
||||||
--- !u!4 &192863443
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 192863441}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 2
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &585803459
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 585803461}
|
|
||||||
- component: {fileID: 585803460}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Directional Light
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!108 &585803460
|
|
||||||
Light:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 585803459}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 10
|
|
||||||
m_Type: 1
|
|
||||||
m_Shape: 0
|
|
||||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
|
||||||
m_Intensity: 1
|
|
||||||
m_Range: 10
|
|
||||||
m_SpotAngle: 30
|
|
||||||
m_InnerSpotAngle: 21.80208
|
|
||||||
m_CookieSize: 10
|
|
||||||
m_Shadows:
|
|
||||||
m_Type: 2
|
|
||||||
m_Resolution: -1
|
|
||||||
m_CustomResolution: -1
|
|
||||||
m_Strength: 1
|
|
||||||
m_Bias: 0.05
|
|
||||||
m_NormalBias: 0.4
|
|
||||||
m_NearPlane: 0.2
|
|
||||||
m_CullingMatrixOverride:
|
|
||||||
e00: 1
|
|
||||||
e01: 0
|
|
||||||
e02: 0
|
|
||||||
e03: 0
|
|
||||||
e10: 0
|
|
||||||
e11: 1
|
|
||||||
e12: 0
|
|
||||||
e13: 0
|
|
||||||
e20: 0
|
|
||||||
e21: 0
|
|
||||||
e22: 1
|
|
||||||
e23: 0
|
|
||||||
e30: 0
|
|
||||||
e31: 0
|
|
||||||
e32: 0
|
|
||||||
e33: 1
|
|
||||||
m_UseCullingMatrixOverride: 0
|
|
||||||
m_Cookie: {fileID: 0}
|
|
||||||
m_DrawHalo: 0
|
|
||||||
m_Flare: {fileID: 0}
|
|
||||||
m_RenderMode: 0
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_Lightmapping: 4
|
|
||||||
m_LightShadowCasterMode: 0
|
|
||||||
m_AreaSize: {x: 1, y: 1}
|
|
||||||
m_BounceIntensity: 1
|
|
||||||
m_ColorTemperature: 6570
|
|
||||||
m_UseColorTemperature: 0
|
|
||||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
m_UseBoundingSphereOverride: 0
|
|
||||||
m_UseViewFrustumForShadowCasterCull: 1
|
|
||||||
m_ShadowRadius: 0
|
|
||||||
m_ShadowAngle: 0
|
|
||||||
--- !u!4 &585803461
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 585803459}
|
|
||||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
|
||||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
|
||||||
--- !u!1 &1189625736
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1189625739}
|
|
||||||
- component: {fileID: 1189625738}
|
|
||||||
- component: {fileID: 1189625737}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Main Camera
|
|
||||||
m_TagString: MainCamera
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!81 &1189625737
|
|
||||||
AudioListener:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1189625736}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &1189625738
|
|
||||||
Camera:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1189625736}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ClearFlags: 1
|
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
|
||||||
m_projectionMatrixMode: 1
|
|
||||||
m_GateFitMode: 2
|
|
||||||
m_FOVAxisMode: 0
|
|
||||||
m_SensorSize: {x: 36, y: 24}
|
|
||||||
m_LensShift: {x: 0, y: 0}
|
|
||||||
m_FocalLength: 50
|
|
||||||
m_NormalizedViewPortRect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: 1
|
|
||||||
height: 1
|
|
||||||
near clip plane: 0.3
|
|
||||||
far clip plane: 1000
|
|
||||||
field of view: 60
|
|
||||||
orthographic: 0
|
|
||||||
orthographic size: 5
|
|
||||||
m_Depth: -1
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingPath: -1
|
|
||||||
m_TargetTexture: {fileID: 0}
|
|
||||||
m_TargetDisplay: 0
|
|
||||||
m_TargetEye: 3
|
|
||||||
m_HDR: 1
|
|
||||||
m_AllowMSAA: 1
|
|
||||||
m_AllowDynamicResolution: 0
|
|
||||||
m_ForceIntoRT: 0
|
|
||||||
m_OcclusionCulling: 1
|
|
||||||
m_StereoConvergence: 10
|
|
||||||
m_StereoSeparation: 0.022
|
|
||||||
--- !u!4 &1189625739
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1189625736}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f2337eeeb085a25408461d996bb20a9c
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,267 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!29 &1
|
|
||||||
OcclusionCullingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_OcclusionBakeSettings:
|
|
||||||
smallestOccluder: 5
|
|
||||||
smallestHole: 0.25
|
|
||||||
backfaceThreshold: 100
|
|
||||||
m_SceneGUID: 00000000000000000000000000000000
|
|
||||||
m_OcclusionCullingData: {fileID: 0}
|
|
||||||
--- !u!104 &2
|
|
||||||
RenderSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 9
|
|
||||||
m_Fog: 0
|
|
||||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
|
||||||
m_FogMode: 3
|
|
||||||
m_FogDensity: 0.01
|
|
||||||
m_LinearFogStart: 0
|
|
||||||
m_LinearFogEnd: 300
|
|
||||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
|
||||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
|
||||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
|
||||||
m_AmbientIntensity: 1
|
|
||||||
m_AmbientMode: 0
|
|
||||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
|
||||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_HaloStrength: 0.5
|
|
||||||
m_FlareStrength: 1
|
|
||||||
m_FlareFadeSpeed: 3
|
|
||||||
m_HaloTexture: {fileID: 0}
|
|
||||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_DefaultReflectionMode: 0
|
|
||||||
m_DefaultReflectionResolution: 128
|
|
||||||
m_ReflectionBounces: 1
|
|
||||||
m_ReflectionIntensity: 1
|
|
||||||
m_CustomReflection: {fileID: 0}
|
|
||||||
m_Sun: {fileID: 705507994}
|
|
||||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
|
||||||
--- !u!157 &3
|
|
||||||
LightmapSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 12
|
|
||||||
m_GIWorkflowMode: 1
|
|
||||||
m_GISettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
|
||||||
m_EnableBakedLightmaps: 1
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_LightmapEditorSettings:
|
|
||||||
serializedVersion: 12
|
|
||||||
m_Resolution: 2
|
|
||||||
m_BakeResolution: 40
|
|
||||||
m_AtlasSize: 1024
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 1
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAmbientOcclusion: 0
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_TextureCompression: 1
|
|
||||||
m_FinalGather: 0
|
|
||||||
m_FinalGatherFiltering: 1
|
|
||||||
m_FinalGatherRayCount: 256
|
|
||||||
m_ReflectionCompression: 2
|
|
||||||
m_MixedBakeMode: 2
|
|
||||||
m_BakeBackend: 1
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 500
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVREnvironmentSampleCount: 500
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_PVRFilteringMode: 2
|
|
||||||
m_PVRDenoiserTypeDirect: 0
|
|
||||||
m_PVRDenoiserTypeIndirect: 0
|
|
||||||
m_PVRDenoiserTypeAO: 0
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVREnvironmentMIS: 0
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 5
|
|
||||||
m_PVRFilteringGaussRadiusAO: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_LightingDataAsset: {fileID: 0}
|
|
||||||
m_LightingSettings: {fileID: 0}
|
|
||||||
--- !u!196 &4
|
|
||||||
NavMeshSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_BuildSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
agentTypeID: 0
|
|
||||||
agentRadius: 0.5
|
|
||||||
agentHeight: 2
|
|
||||||
agentSlope: 45
|
|
||||||
agentClimb: 0.4
|
|
||||||
ledgeDropHeight: 0
|
|
||||||
maxJumpAcrossDistance: 0
|
|
||||||
minRegionArea: 2
|
|
||||||
manualCellSize: 0
|
|
||||||
cellSize: 0.16666667
|
|
||||||
manualTileSize: 0
|
|
||||||
tileSize: 256
|
|
||||||
accuratePlacement: 0
|
|
||||||
debug:
|
|
||||||
m_Flags: 0
|
|
||||||
m_NavMeshData: {fileID: 0}
|
|
||||||
--- !u!1 &705507993
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 705507995}
|
|
||||||
- component: {fileID: 705507994}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Directional Light
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!108 &705507994
|
|
||||||
Light:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 705507993}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 8
|
|
||||||
m_Type: 1
|
|
||||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
|
||||||
m_Intensity: 1
|
|
||||||
m_Range: 10
|
|
||||||
m_SpotAngle: 30
|
|
||||||
m_CookieSize: 10
|
|
||||||
m_Shadows:
|
|
||||||
m_Type: 2
|
|
||||||
m_Resolution: -1
|
|
||||||
m_CustomResolution: -1
|
|
||||||
m_Strength: 1
|
|
||||||
m_Bias: 0.05
|
|
||||||
m_NormalBias: 0.4
|
|
||||||
m_NearPlane: 0.2
|
|
||||||
m_Cookie: {fileID: 0}
|
|
||||||
m_DrawHalo: 0
|
|
||||||
m_Flare: {fileID: 0}
|
|
||||||
m_RenderMode: 0
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_Lightmapping: 1
|
|
||||||
m_LightShadowCasterMode: 0
|
|
||||||
m_AreaSize: {x: 1, y: 1}
|
|
||||||
m_BounceIntensity: 1
|
|
||||||
m_ColorTemperature: 6570
|
|
||||||
m_UseColorTemperature: 0
|
|
||||||
m_ShadowRadius: 0
|
|
||||||
m_ShadowAngle: 0
|
|
||||||
--- !u!4 &705507995
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 705507993}
|
|
||||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
|
||||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
|
||||||
--- !u!1 &963194225
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 963194228}
|
|
||||||
- component: {fileID: 963194227}
|
|
||||||
- component: {fileID: 963194226}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Main Camera
|
|
||||||
m_TagString: MainCamera
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!81 &963194226
|
|
||||||
AudioListener:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &963194227
|
|
||||||
Camera:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ClearFlags: 1
|
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
|
||||||
m_projectionMatrixMode: 1
|
|
||||||
m_SensorSize: {x: 36, y: 24}
|
|
||||||
m_LensShift: {x: 0, y: 0}
|
|
||||||
m_GateFitMode: 2
|
|
||||||
m_FocalLength: 50
|
|
||||||
m_NormalizedViewPortRect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: 1
|
|
||||||
height: 1
|
|
||||||
near clip plane: 0.3
|
|
||||||
far clip plane: 1000
|
|
||||||
field of view: 60
|
|
||||||
orthographic: 0
|
|
||||||
orthographic size: 5
|
|
||||||
m_Depth: -1
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingPath: -1
|
|
||||||
m_TargetTexture: {fileID: 0}
|
|
||||||
m_TargetDisplay: 0
|
|
||||||
m_TargetEye: 3
|
|
||||||
m_HDR: 1
|
|
||||||
m_AllowMSAA: 1
|
|
||||||
m_AllowDynamicResolution: 0
|
|
||||||
m_ForceIntoRT: 0
|
|
||||||
m_OcclusionCulling: 1
|
|
||||||
m_StereoConvergence: 10
|
|
||||||
m_StereoSeparation: 0.022
|
|
||||||
--- !u!4 &963194228
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 963194225}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,347 +0,0 @@
|
|||||||
%YAML 1.1
|
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
|
||||||
--- !u!29 &1
|
|
||||||
OcclusionCullingSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_OcclusionBakeSettings:
|
|
||||||
smallestOccluder: 5
|
|
||||||
smallestHole: 0.25
|
|
||||||
backfaceThreshold: 100
|
|
||||||
m_SceneGUID: 00000000000000000000000000000000
|
|
||||||
m_OcclusionCullingData: {fileID: 0}
|
|
||||||
--- !u!104 &2
|
|
||||||
RenderSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 9
|
|
||||||
m_Fog: 0
|
|
||||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
|
||||||
m_FogMode: 3
|
|
||||||
m_FogDensity: 0.01
|
|
||||||
m_LinearFogStart: 0
|
|
||||||
m_LinearFogEnd: 300
|
|
||||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
|
||||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
|
||||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
|
||||||
m_AmbientIntensity: 1
|
|
||||||
m_AmbientMode: 0
|
|
||||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
|
||||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
|
||||||
m_HaloStrength: 0.5
|
|
||||||
m_FlareStrength: 1
|
|
||||||
m_FlareFadeSpeed: 3
|
|
||||||
m_HaloTexture: {fileID: 0}
|
|
||||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_DefaultReflectionMode: 0
|
|
||||||
m_DefaultReflectionResolution: 128
|
|
||||||
m_ReflectionBounces: 1
|
|
||||||
m_ReflectionIntensity: 1
|
|
||||||
m_CustomReflection: {fileID: 0}
|
|
||||||
m_Sun: {fileID: 0}
|
|
||||||
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
|
||||||
--- !u!157 &3
|
|
||||||
LightmapSettings:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 12
|
|
||||||
m_GIWorkflowMode: 1
|
|
||||||
m_GISettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_BounceScale: 1
|
|
||||||
m_IndirectOutputScale: 1
|
|
||||||
m_AlbedoBoost: 1
|
|
||||||
m_EnvironmentLightingMode: 0
|
|
||||||
m_EnableBakedLightmaps: 1
|
|
||||||
m_EnableRealtimeLightmaps: 0
|
|
||||||
m_LightmapEditorSettings:
|
|
||||||
serializedVersion: 12
|
|
||||||
m_Resolution: 2
|
|
||||||
m_BakeResolution: 40
|
|
||||||
m_AtlasSize: 1024
|
|
||||||
m_AO: 0
|
|
||||||
m_AOMaxDistance: 1
|
|
||||||
m_CompAOExponent: 1
|
|
||||||
m_CompAOExponentDirect: 0
|
|
||||||
m_ExtractAmbientOcclusion: 0
|
|
||||||
m_Padding: 2
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_LightmapsBakeMode: 1
|
|
||||||
m_TextureCompression: 1
|
|
||||||
m_FinalGather: 0
|
|
||||||
m_FinalGatherFiltering: 1
|
|
||||||
m_FinalGatherRayCount: 256
|
|
||||||
m_ReflectionCompression: 2
|
|
||||||
m_MixedBakeMode: 2
|
|
||||||
m_BakeBackend: 1
|
|
||||||
m_PVRSampling: 1
|
|
||||||
m_PVRDirectSampleCount: 32
|
|
||||||
m_PVRSampleCount: 512
|
|
||||||
m_PVRBounces: 2
|
|
||||||
m_PVREnvironmentSampleCount: 256
|
|
||||||
m_PVREnvironmentReferencePointCount: 2048
|
|
||||||
m_PVRFilteringMode: 1
|
|
||||||
m_PVRDenoiserTypeDirect: 1
|
|
||||||
m_PVRDenoiserTypeIndirect: 1
|
|
||||||
m_PVRDenoiserTypeAO: 1
|
|
||||||
m_PVRFilterTypeDirect: 0
|
|
||||||
m_PVRFilterTypeIndirect: 0
|
|
||||||
m_PVRFilterTypeAO: 0
|
|
||||||
m_PVREnvironmentMIS: 1
|
|
||||||
m_PVRCulling: 1
|
|
||||||
m_PVRFilteringGaussRadiusDirect: 1
|
|
||||||
m_PVRFilteringGaussRadiusIndirect: 5
|
|
||||||
m_PVRFilteringGaussRadiusAO: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
|
||||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
|
||||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
|
||||||
m_ExportTrainingData: 0
|
|
||||||
m_TrainingDataDestination: TrainingData
|
|
||||||
m_LightProbeSampleCountMultiplier: 4
|
|
||||||
m_LightingDataAsset: {fileID: 0}
|
|
||||||
m_LightingSettings: {fileID: 0}
|
|
||||||
--- !u!196 &4
|
|
||||||
NavMeshSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_BuildSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
agentTypeID: 0
|
|
||||||
agentRadius: 0.5
|
|
||||||
agentHeight: 2
|
|
||||||
agentSlope: 45
|
|
||||||
agentClimb: 0.4
|
|
||||||
ledgeDropHeight: 0
|
|
||||||
maxJumpAcrossDistance: 0
|
|
||||||
minRegionArea: 2
|
|
||||||
manualCellSize: 0
|
|
||||||
cellSize: 0.16666667
|
|
||||||
manualTileSize: 0
|
|
||||||
tileSize: 256
|
|
||||||
accuratePlacement: 0
|
|
||||||
maxJobWorkers: 0
|
|
||||||
preserveTilesOutsideBounds: 0
|
|
||||||
debug:
|
|
||||||
m_Flags: 0
|
|
||||||
m_NavMeshData: {fileID: 0}
|
|
||||||
--- !u!1 &736700400
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 736700402}
|
|
||||||
- component: {fileID: 736700401}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: GameObject
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!114 &736700401
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 736700400}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 67d53e2f993d4a5ba0eb34431d1846cd, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!4 &736700402
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 736700400}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 2
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &1077233431
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1077233433}
|
|
||||||
- component: {fileID: 1077233432}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Directional Light
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!108 &1077233432
|
|
||||||
Light:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1077233431}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 10
|
|
||||||
m_Type: 1
|
|
||||||
m_Shape: 0
|
|
||||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
|
||||||
m_Intensity: 1
|
|
||||||
m_Range: 10
|
|
||||||
m_SpotAngle: 30
|
|
||||||
m_InnerSpotAngle: 21.80208
|
|
||||||
m_CookieSize: 10
|
|
||||||
m_Shadows:
|
|
||||||
m_Type: 2
|
|
||||||
m_Resolution: -1
|
|
||||||
m_CustomResolution: -1
|
|
||||||
m_Strength: 1
|
|
||||||
m_Bias: 0.05
|
|
||||||
m_NormalBias: 0.4
|
|
||||||
m_NearPlane: 0.2
|
|
||||||
m_CullingMatrixOverride:
|
|
||||||
e00: 1
|
|
||||||
e01: 0
|
|
||||||
e02: 0
|
|
||||||
e03: 0
|
|
||||||
e10: 0
|
|
||||||
e11: 1
|
|
||||||
e12: 0
|
|
||||||
e13: 0
|
|
||||||
e20: 0
|
|
||||||
e21: 0
|
|
||||||
e22: 1
|
|
||||||
e23: 0
|
|
||||||
e30: 0
|
|
||||||
e31: 0
|
|
||||||
e32: 0
|
|
||||||
e33: 1
|
|
||||||
m_UseCullingMatrixOverride: 0
|
|
||||||
m_Cookie: {fileID: 0}
|
|
||||||
m_DrawHalo: 0
|
|
||||||
m_Flare: {fileID: 0}
|
|
||||||
m_RenderMode: 0
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingLayerMask: 1
|
|
||||||
m_Lightmapping: 4
|
|
||||||
m_LightShadowCasterMode: 0
|
|
||||||
m_AreaSize: {x: 1, y: 1}
|
|
||||||
m_BounceIntensity: 1
|
|
||||||
m_ColorTemperature: 6570
|
|
||||||
m_UseColorTemperature: 0
|
|
||||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
m_UseBoundingSphereOverride: 0
|
|
||||||
m_UseViewFrustumForShadowCasterCull: 1
|
|
||||||
m_ShadowRadius: 0
|
|
||||||
m_ShadowAngle: 0
|
|
||||||
--- !u!4 &1077233433
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1077233431}
|
|
||||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
|
||||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
|
||||||
--- !u!1 &1698122894
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1698122897}
|
|
||||||
- component: {fileID: 1698122896}
|
|
||||||
- component: {fileID: 1698122895}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Main Camera
|
|
||||||
m_TagString: MainCamera
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!81 &1698122895
|
|
||||||
AudioListener:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1698122894}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &1698122896
|
|
||||||
Camera:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1698122894}
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 2
|
|
||||||
m_ClearFlags: 1
|
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
|
||||||
m_projectionMatrixMode: 1
|
|
||||||
m_GateFitMode: 2
|
|
||||||
m_FOVAxisMode: 0
|
|
||||||
m_SensorSize: {x: 36, y: 24}
|
|
||||||
m_LensShift: {x: 0, y: 0}
|
|
||||||
m_FocalLength: 50
|
|
||||||
m_NormalizedViewPortRect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: 1
|
|
||||||
height: 1
|
|
||||||
near clip plane: 0.3
|
|
||||||
far clip plane: 1000
|
|
||||||
field of view: 60
|
|
||||||
orthographic: 0
|
|
||||||
orthographic size: 5
|
|
||||||
m_Depth: -1
|
|
||||||
m_CullingMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967295
|
|
||||||
m_RenderingPath: -1
|
|
||||||
m_TargetTexture: {fileID: 0}
|
|
||||||
m_TargetDisplay: 0
|
|
||||||
m_TargetEye: 3
|
|
||||||
m_HDR: 1
|
|
||||||
m_AllowMSAA: 1
|
|
||||||
m_AllowDynamicResolution: 0
|
|
||||||
m_ForceIntoRT: 0
|
|
||||||
m_OcclusionCulling: 1
|
|
||||||
m_StereoConvergence: 10
|
|
||||||
m_StereoSeparation: 0.022
|
|
||||||
--- !u!4 &1698122897
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1698122894}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b95b5f3924bd65b4bb0b7703abdd4fe5
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 478095eaef020f34ea189f98c9369aab
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,31 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
|
|
||||||
using System.Collections;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.TestTools;
|
|
||||||
using Object = UnityEngine.Object;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
public class ComponentTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void GetComponentsInChildrenOnly_ShouldIgnoreParent()
|
|
||||||
{
|
|
||||||
var parent = new GameObject();
|
|
||||||
var rigidbody = parent.AddComponent<Rigidbody>();
|
|
||||||
|
|
||||||
var child = new GameObject();
|
|
||||||
child.transform.SetParent(parent.transform);
|
|
||||||
child.AddComponent<Rigidbody>();
|
|
||||||
|
|
||||||
Rigidbody[] components = rigidbody.GetComponentsInChildrenOnly<Rigidbody>();
|
|
||||||
Assert.That(components, Has.Length.EqualTo(1));
|
|
||||||
Assert.That(child, Is.EqualTo(components[0].gameObject));
|
|
||||||
|
|
||||||
Object.Destroy(parent);
|
|
||||||
Object.Destroy(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0619dbb274114e4aa247ed8f4e7cff03
|
|
||||||
timeCreated: 1652006240
|
|
@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Drawing;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Color = UnityEngine.Color;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
internal sealed class DebugUtilityIntegrationTests : MonoBehaviour
|
|
||||||
{
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
DebugUtility.DrawLine(Vector3.zero, Vector3.right, Color.red);
|
|
||||||
DebugUtility.DrawLine(Vector3.zero, Vector3.up, Color.green);
|
|
||||||
DebugUtility.DrawLine(Vector3.zero, Vector3.forward, Color.blue);
|
|
||||||
|
|
||||||
DebugUtility.DrawWireCube(new Vector3(1.5f, 0.5f, 0), Vector3.one * 0.5f, Color.yellow);
|
|
||||||
DebugUtility.DrawRectangle(new Vector2(-1.5f, 0.5f), Vector2.one * -0.5f, Color.cyan);
|
|
||||||
|
|
||||||
var circle = new CircleF(0.0f, 0.0f, 0.5f);
|
|
||||||
DebugUtility.DrawCircle(circle, 25, new Vector2(-3.0f, 0.5f), Color.magenta);
|
|
||||||
|
|
||||||
var ellipse = new EllipseF(0.0f, 0.0f, 1.0f, 0.5f);
|
|
||||||
DebugUtility.DrawEllipse(ellipse, 25, new Vector2(0.0f, 1.5f), Color.white);
|
|
||||||
|
|
||||||
var hexagon = new PolygonF();
|
|
||||||
hexagon.AddVertex(new Vector2(-0.5f, 0.5f));
|
|
||||||
hexagon.AddVertex(new Vector2(-0.25f, 1.0f));
|
|
||||||
hexagon.AddVertex(new Vector2(0.25f, 1.0f));
|
|
||||||
hexagon.AddVertex(new Vector2(0.5f, 0.5f));
|
|
||||||
hexagon.AddVertex(new Vector2(0.25f, 0));
|
|
||||||
hexagon.AddVertex(new Vector2(-0.25f, 0));
|
|
||||||
DebugUtility.DrawPolygon(hexagon, new Vector2(3.0f, 0.0f), Color.white);
|
|
||||||
|
|
||||||
var sphere = new Sphere(System.Numerics.Vector3.Zero, 0.5f);
|
|
||||||
DebugUtility.DrawSphere(sphere, 25, new Vector2(0.0f, -1.5f), Color.white);
|
|
||||||
|
|
||||||
DebugUtility.DrawFunction(x => MathF.Sin(x + UnityEngine.Time.time % (2 * MathF.PI)), -10, 10, 0.1f, Vector3.up * 4,
|
|
||||||
Color.yellow, 0.0f, false);
|
|
||||||
|
|
||||||
DebugUtility.Assert(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0fac6b15ed0b420ba300fc1ac10ef01a
|
|
||||||
timeCreated: 1654080788
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9674f5a2171d4c7d88cbfe9f1249bb27
|
|
||||||
timeCreated: 1652006440
|
|
@ -1,123 +0,0 @@
|
|||||||
using System;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class Color32Tests
|
|
||||||
{
|
|
||||||
private static readonly Color32 Black = new(0, 0, 0, 255);
|
|
||||||
private static readonly Color32 White = new(255, 255, 255, 255);
|
|
||||||
private static readonly Color32 Red = new(255, 0, 0, 255);
|
|
||||||
private static readonly Color32 Green = new(0, 255, 0, 255);
|
|
||||||
private static readonly Color32 Blue = new(0, 0, 255, 255);
|
|
||||||
private static readonly Color32 Cyan = new(0, 255, 255, 255);
|
|
||||||
private static readonly Color32 Magenta = new(255, 0, 255, 255);
|
|
||||||
private static readonly Color32 Yellow = new(255, 255, 0, 255);
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldDeconstruct_ToCorrectValues()
|
|
||||||
{
|
|
||||||
byte a, r, g, b;
|
|
||||||
|
|
||||||
(r, g, b) = White;
|
|
||||||
Assert.That(r, Is.EqualTo(255));
|
|
||||||
Assert.That(g, Is.EqualTo(255));
|
|
||||||
Assert.That(b, Is.EqualTo(255));
|
|
||||||
|
|
||||||
(a, r, g, b) = Yellow;
|
|
||||||
Assert.That(a, Is.EqualTo(255));
|
|
||||||
Assert.That(r, Is.EqualTo(255));
|
|
||||||
Assert.That(g, Is.EqualTo(255));
|
|
||||||
Assert.That(b, Is.EqualTo(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void GetClosestConsoleColor_ShouldReturnClosestColor_GivenValidColor()
|
|
||||||
{
|
|
||||||
// I know it's just casting... but aim for 100% coverage babyyyy
|
|
||||||
|
|
||||||
Assert.That(((Color32)Color.red).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Red));
|
|
||||||
Assert.That(((Color32)Color.green).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Green));
|
|
||||||
Assert.That(((Color32)Color.blue).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Blue));
|
|
||||||
Assert.That(((Color32)Color.white).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.White));
|
|
||||||
Assert.That(((Color32)Color.black).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Black));
|
|
||||||
Assert.That(((Color32)Color.yellow).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Yellow));
|
|
||||||
Assert.That(((Color32)Color.cyan).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Cyan));
|
|
||||||
Assert.That(((Color32)Color.magenta).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Magenta));
|
|
||||||
Assert.That(((Color32)Color.gray).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Gray));
|
|
||||||
Assert.That(((Color32)Color.grey).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Gray));
|
|
||||||
Assert.That(((Color32)Color.clear).GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Black));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Inverted_ShouldReturnInvertedColor()
|
|
||||||
{
|
|
||||||
Assert.That(Black.Inverted(), Is.EqualTo(White));
|
|
||||||
Assert.That(White.Inverted(), Is.EqualTo(Black));
|
|
||||||
Assert.That(Cyan.Inverted(), Is.EqualTo(Red));
|
|
||||||
Assert.That(Red.Inverted(), Is.EqualTo(Cyan));
|
|
||||||
Assert.That(Magenta.Inverted(), Is.EqualTo(Green));
|
|
||||||
Assert.That(Green.Inverted(), Is.EqualTo(Magenta));
|
|
||||||
Assert.That(Blue.Inverted(), Is.EqualTo(Yellow));
|
|
||||||
Assert.That(Yellow.Inverted(), Is.EqualTo(Blue));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Inverted_ShouldIgnoreAlpha()
|
|
||||||
{
|
|
||||||
var expected = new Color32(0, 0, 0, 255);
|
|
||||||
var actual = new Color32(255, 255, 255, 255).Inverted();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemDrawingColor_ShouldReturnEquivalentColor()
|
|
||||||
{
|
|
||||||
System.Drawing.Color expected = System.Drawing.Color.FromArgb(255, 255, 255);
|
|
||||||
System.Drawing.Color actual = White.ToSystemDrawingColor();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityColor32_ShouldReturnEquivalentColor()
|
|
||||||
{
|
|
||||||
Color32 expected = White;
|
|
||||||
Color32 actual = System.Drawing.Color.FromArgb(255, 255, 255).ToUnityColor32();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithA0_ShouldReturnSameColor_GivenWhite()
|
|
||||||
{
|
|
||||||
var transparent = new Color32(255, 255, 255, 0);
|
|
||||||
Assert.That(White.WithA(0), Is.EqualTo(transparent));
|
|
||||||
Assert.That(transparent.WithA(0), Is.EqualTo(transparent));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithB0_ShouldReturnYellow_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithB(0), Is.EqualTo(Yellow));
|
|
||||||
Assert.That(Yellow.WithB(0), Is.EqualTo(Yellow));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithG0_ShouldReturnMagenta_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithG(0), Is.EqualTo(Magenta));
|
|
||||||
Assert.That(Magenta.WithG(0), Is.EqualTo(Magenta));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithR0_ShouldReturnCyan_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithR(0), Is.EqualTo(Cyan));
|
|
||||||
Assert.That(Cyan.WithR(0), Is.EqualTo(Cyan));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 877c5a68b0dd44c68aae01463ae26b26
|
|
||||||
timeCreated: 1652035626
|
|
@ -1,121 +0,0 @@
|
|||||||
using System;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class ColorTests
|
|
||||||
{
|
|
||||||
private static readonly Color Black = new(0, 0, 0);
|
|
||||||
private static readonly Color White = new(1, 1, 1);
|
|
||||||
private static readonly Color Red = new(1, 0, 0);
|
|
||||||
private static readonly Color Green = new(0, 1, 0);
|
|
||||||
private static readonly Color Blue = new(0, 0, 1);
|
|
||||||
private static readonly Color Cyan = new(0, 1, 1);
|
|
||||||
private static readonly Color Magenta = new(1, 0, 1);
|
|
||||||
private static readonly Color Yellow = new(1, 1, 0);
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldDeconstruct_ToCorrectValues()
|
|
||||||
{
|
|
||||||
float a, r, g, b;
|
|
||||||
|
|
||||||
(r, g, b) = White;
|
|
||||||
Assert.That(r, Is.EqualTo(1.0f));
|
|
||||||
Assert.That(g, Is.EqualTo(1.0f));
|
|
||||||
Assert.That(b, Is.EqualTo(1.0f));
|
|
||||||
|
|
||||||
(a, r, g, b) = Yellow;
|
|
||||||
Assert.That(a, Is.EqualTo(1.0f));
|
|
||||||
Assert.That(r, Is.EqualTo(1.0f));
|
|
||||||
Assert.That(g, Is.EqualTo(1.0f));
|
|
||||||
Assert.That(b, Is.EqualTo(0.0f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void GetClosestConsoleColor_ShouldReturnClosestColor_GivenValidColor()
|
|
||||||
{
|
|
||||||
Assert.That(Color.red.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Red));
|
|
||||||
Assert.That(Color.green.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Green));
|
|
||||||
Assert.That(Color.blue.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Blue));
|
|
||||||
Assert.That(Color.white.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.White));
|
|
||||||
Assert.That(Color.black.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Black));
|
|
||||||
Assert.That(Color.yellow.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Yellow));
|
|
||||||
Assert.That(Color.cyan.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Cyan));
|
|
||||||
Assert.That(Color.magenta.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Magenta));
|
|
||||||
Assert.That(Color.gray.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Gray));
|
|
||||||
Assert.That(Color.grey.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Gray));
|
|
||||||
Assert.That(Color.clear.GetClosestConsoleColor(), Is.EqualTo(ConsoleColor.Black));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Inverted_ShouldReturnInvertedColor()
|
|
||||||
{
|
|
||||||
Assert.That(Black.Inverted(), Is.EqualTo(White));
|
|
||||||
Assert.That(White.Inverted(), Is.EqualTo(Black));
|
|
||||||
Assert.That(Cyan.Inverted(), Is.EqualTo(Red));
|
|
||||||
Assert.That(Red.Inverted(), Is.EqualTo(Cyan));
|
|
||||||
Assert.That(Magenta.Inverted(), Is.EqualTo(Green));
|
|
||||||
Assert.That(Green.Inverted(), Is.EqualTo(Magenta));
|
|
||||||
Assert.That(Blue.Inverted(), Is.EqualTo(Yellow));
|
|
||||||
Assert.That(Yellow.Inverted(), Is.EqualTo(Blue));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Inverted_ShouldIgnoreAlpha()
|
|
||||||
{
|
|
||||||
var expected = new Color(0, 0, 0, 1);
|
|
||||||
var actual = new Color(1, 1, 1, 1).Inverted();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemDrawingColor_ShouldReturnEquivalentColor()
|
|
||||||
{
|
|
||||||
System.Drawing.Color expected = System.Drawing.Color.FromArgb(255, 255, 255);
|
|
||||||
System.Drawing.Color actual = White.ToSystemDrawingColor();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityColor_ShouldReturnEquivalentColor()
|
|
||||||
{
|
|
||||||
Color expected = White;
|
|
||||||
Color actual = System.Drawing.Color.FromArgb(255, 255, 255).ToUnityColor();
|
|
||||||
|
|
||||||
Assert.That(actual, Is.EqualTo(expected));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithA0_ShouldReturnSameColor_GivenWhite()
|
|
||||||
{
|
|
||||||
var transparent = new Color(1, 1, 1, 0);
|
|
||||||
Assert.That(White.WithA(0), Is.EqualTo(transparent));
|
|
||||||
Assert.That(transparent.WithA(0), Is.EqualTo(transparent));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithB0_ShouldReturnYellow_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithB(0), Is.EqualTo(Yellow));
|
|
||||||
Assert.That(Yellow.WithB(0), Is.EqualTo(Yellow));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithG0_ShouldReturnMagenta_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithG(0), Is.EqualTo(Magenta));
|
|
||||||
Assert.That(Magenta.WithG(0), Is.EqualTo(Magenta));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithR0_ShouldReturnCyan_GivenWhite()
|
|
||||||
{
|
|
||||||
Assert.That(White.WithR(0), Is.EqualTo(Cyan));
|
|
||||||
Assert.That(Cyan.WithR(0), Is.EqualTo(Cyan));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 61df0ae6778a4ab084e688f13adfc29c
|
|
||||||
timeCreated: 1652035747
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class PointFTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var point = new PointF(random.NextSingle(), random.NextSingle());
|
|
||||||
var vector = point.ToUnityVector2();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(point.X).Within(1e-6f));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(point.Y).Within(1e-6f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d90695756d1d4760aef2523486b1b41e
|
|
||||||
timeCreated: 1653743243
|
|
@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class PointTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var point = new Point(random.Next(), random.Next());
|
|
||||||
var vector = point.ToUnityVector2();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(point.X));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(point.Y));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2Int_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var point = new Point(random.Next(), random.Next());
|
|
||||||
var vector = point.ToUnityVector2Int();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(point.X));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(point.Y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f465794fdc394d05a34229f34e5199e2
|
|
||||||
timeCreated: 1653742987
|
|
@ -1,77 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class RandomTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void NextColorArgb_ShouldReturn331515e5_GivenSeed1234()
|
|
||||||
{
|
|
||||||
var random = new Random(1234);
|
|
||||||
var color = random.NextColorArgb();
|
|
||||||
Assert.That(color.r, Is.EqualTo(0.373868465f).Within(1e-6f));
|
|
||||||
Assert.That(color.g, Is.EqualTo(0.391597569f).Within(1e-6f));
|
|
||||||
Assert.That(color.b, Is.EqualTo(0.675019085f).Within(1e-6f));
|
|
||||||
Assert.That(color.a, Is.EqualTo(0.234300315f).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColorArgb_ShouldThrow_GivenNull()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextColorArgb());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColor32Argb_ShouldReturn331515e5_GivenSeed1234()
|
|
||||||
{
|
|
||||||
var random = new Random(1234);
|
|
||||||
Assert.That(random.NextColor32Argb(), Is.EqualTo(new Color32(21, 21, 229, 51)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColor32Argb_ShouldThrow_GivenNull()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextColor32Argb());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColorRgb_ShouldReturn1515e5_GivenSeed1234()
|
|
||||||
{
|
|
||||||
var random = new Random(1234);
|
|
||||||
var color = random.NextColorRgb();
|
|
||||||
Assert.That(color.r, Is.EqualTo(0.234300315f).Within(1e-6f));
|
|
||||||
Assert.That(color.g, Is.EqualTo(0.373868465f).Within(1e-6f));
|
|
||||||
Assert.That(color.b, Is.EqualTo(0.391597569f).Within(1e-6f));
|
|
||||||
Assert.That(color.a, Is.EqualTo(1).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColorRgb_ShouldThrow_GivenNull()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextColorRgb());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColor32Rgb_ShouldReturn1515e5_GivenSeed1234()
|
|
||||||
{
|
|
||||||
var random = new Random(1234);
|
|
||||||
Assert.That(random.NextColor32Rgb(), Is.EqualTo(new Color32(21, 21, 229, 255)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextColor32Rgb_ShouldThrow_GivenNull()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextColor32Rgb());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 28fa03c101834cd79774d8138b9d4adb
|
|
||||||
timeCreated: 1652006445
|
|
@ -1,36 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class RectIntTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToSystemRectangle_ShouldReturnRectangleF_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rect = new RectInt(random.Next(), random.Next(), random.Next(), random.Next());
|
|
||||||
var rectangle = rect.ToSystemRectangle();
|
|
||||||
|
|
||||||
Assert.That(rectangle.X, Is.EqualTo(rect.x));
|
|
||||||
Assert.That(rectangle.Y, Is.EqualTo(rect.y));
|
|
||||||
Assert.That(rectangle.Width, Is.EqualTo(rect.width));
|
|
||||||
Assert.That(rectangle.Height, Is.EqualTo(rect.height));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemRectangleF_ShouldReturnRectangleF_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rect = new RectInt(random.Next(), random.Next(), random.Next(), random.Next());
|
|
||||||
var rectangle = rect.ToSystemRectangleF();
|
|
||||||
|
|
||||||
Assert.That(rectangle.X, Is.EqualTo(rect.x));
|
|
||||||
Assert.That(rectangle.Y, Is.EqualTo(rect.y));
|
|
||||||
Assert.That(rectangle.Width, Is.EqualTo(rect.width));
|
|
||||||
Assert.That(rectangle.Height, Is.EqualTo(rect.height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 18f2e8fbc200475ca5fe7857a457a874
|
|
||||||
timeCreated: 1654077768
|
|
@ -1,24 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class RectTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToSystemRectangleF_ShouldReturnRectangleF_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rect = new Rect(random.NextSingle(), random.NextSingle(), random.NextSingle(), random.NextSingle());
|
|
||||||
var rectangle = rect.ToSystemRectangleF();
|
|
||||||
|
|
||||||
Assert.That(rectangle.X, Is.EqualTo(rect.x).Within(1e-6f));
|
|
||||||
Assert.That(rectangle.Y, Is.EqualTo(rect.y).Within(1e-6f));
|
|
||||||
Assert.That(rectangle.Width, Is.EqualTo(rect.width).Within(1e-6f));
|
|
||||||
Assert.That(rectangle.Height, Is.EqualTo(rect.height).Within(1e-6f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bb1ec5372c354f06b39e03649b9307db
|
|
||||||
timeCreated: 1653743583
|
|
@ -1,24 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class RectangleFTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityRect_ShouldReturnRect_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rectangle = new RectangleF(random.NextSingle(), random.NextSingle(), random.NextSingle(), random.NextSingle());
|
|
||||||
var rect = rectangle.ToUnityRect();
|
|
||||||
|
|
||||||
Assert.That(rect.x, Is.EqualTo(rectangle.X).Within(1e-6f));
|
|
||||||
Assert.That(rect.y, Is.EqualTo(rectangle.Y).Within(1e-6f));
|
|
||||||
Assert.That(rect.width, Is.EqualTo(rectangle.Width).Within(1e-6f));
|
|
||||||
Assert.That(rect.height, Is.EqualTo(rectangle.Height).Within(1e-6f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f38cbc892021405cad2b52de1f960a00
|
|
||||||
timeCreated: 1653743640
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class RectangleTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityRect_ShouldReturnRect_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
||||||
var rect = rectangle.ToUnityRect();
|
|
||||||
|
|
||||||
Assert.That(rect.x, Is.EqualTo(rectangle.X));
|
|
||||||
Assert.That(rect.y, Is.EqualTo(rectangle.Y));
|
|
||||||
Assert.That(rect.width, Is.EqualTo(rectangle.Width));
|
|
||||||
Assert.That(rect.height, Is.EqualTo(rectangle.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityRectInt_ShouldReturnRect_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
||||||
var rect = rectangle.ToUnityRectInt();
|
|
||||||
|
|
||||||
Assert.That(rect.x, Is.EqualTo(rectangle.X));
|
|
||||||
Assert.That(rect.y, Is.EqualTo(rectangle.Y));
|
|
||||||
Assert.That(rect.width, Is.EqualTo(rectangle.Width));
|
|
||||||
Assert.That(rect.height, Is.EqualTo(rectangle.Height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9c74177035d1452a8a7ca08c0a27124b
|
|
||||||
timeCreated: 1653743677
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class SizeFTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var size = new SizeF(random.NextSingle(), random.NextSingle());
|
|
||||||
var vector = size.ToUnityVector2();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(size.Width).Within(1e-6f));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(size.Height).Within(1e-6f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b93fe56510de4ddcb9354bde7f10c362
|
|
||||||
timeCreated: 1653743377
|
|
@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Unity.Drawing;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Drawing
|
|
||||||
{
|
|
||||||
public class SizeTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var size = new Size(random.Next(), random.Next());
|
|
||||||
var vector = size.ToUnityVector2();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(size.Width));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(size.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector2Int_ShouldReturnVector_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var size = new Size(random.Next(), random.Next());
|
|
||||||
var vector = size.ToUnityVector2Int();
|
|
||||||
|
|
||||||
Assert.That(vector.x, Is.EqualTo(size.Width));
|
|
||||||
Assert.That(vector.y, Is.EqualTo(size.Height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c748bfe02fce4b459df7ef2779c2a486
|
|
||||||
timeCreated: 1653743400
|
|
@ -1,116 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using Object = UnityEngine.Object;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
public class GameObjectTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void GetComponentsInChildrenOnly_ShouldIgnoreParent()
|
|
||||||
{
|
|
||||||
var parent = new GameObject();
|
|
||||||
parent.AddComponent<Rigidbody>();
|
|
||||||
|
|
||||||
var child = new GameObject();
|
|
||||||
child.transform.SetParent(parent.transform);
|
|
||||||
child.AddComponent<Rigidbody>();
|
|
||||||
|
|
||||||
Rigidbody[] components = parent.GetComponentsInChildrenOnly<Rigidbody>();
|
|
||||||
Assert.That(components, Has.Length.EqualTo(1));
|
|
||||||
Assert.That(child, Is.EqualTo(components[0].gameObject));
|
|
||||||
|
|
||||||
Object.Destroy(parent);
|
|
||||||
Object.Destroy(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")]
|
|
||||||
public void LookAt_ShouldRotateSameAsTransform()
|
|
||||||
{
|
|
||||||
var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
|
||||||
var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}};
|
|
||||||
Transform firstTransform = first.transform;
|
|
||||||
Transform secondTransform = second.transform;
|
|
||||||
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
Assert.That(secondTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
firstTransform.LookAt(secondTransform);
|
|
||||||
Quaternion expected = firstTransform.rotation;
|
|
||||||
|
|
||||||
firstTransform.rotation = Quaternion.identity;
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
first.LookAt(second);
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(expected));
|
|
||||||
|
|
||||||
firstTransform.rotation = Quaternion.identity;
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
first.LookAt(second.transform);
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(expected));
|
|
||||||
|
|
||||||
firstTransform.rotation = Quaternion.identity;
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
first.LookAt(Vector3.right);
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(expected));
|
|
||||||
|
|
||||||
Object.Destroy(first);
|
|
||||||
Object.Destroy(second);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void SetLayerRecursively_ShouldSetLayerRecursively()
|
|
||||||
{
|
|
||||||
var parent = new GameObject();
|
|
||||||
var child = new GameObject();
|
|
||||||
var grandChild = new GameObject();
|
|
||||||
|
|
||||||
child.transform.SetParent(parent.transform);
|
|
||||||
grandChild.transform.SetParent(child.transform);
|
|
||||||
|
|
||||||
int layer = LayerMask.NameToLayer("UI");
|
|
||||||
Assert.AreNotEqual(layer, parent.layer);
|
|
||||||
Assert.AreNotEqual(layer, child.layer);
|
|
||||||
Assert.AreNotEqual(layer, grandChild.layer);
|
|
||||||
|
|
||||||
parent.SetLayerRecursively(layer);
|
|
||||||
|
|
||||||
Assert.That(parent.layer, Is.EqualTo(layer));
|
|
||||||
Assert.That(child.layer, Is.EqualTo(layer));
|
|
||||||
Assert.That(grandChild.layer, Is.EqualTo(layer));
|
|
||||||
|
|
||||||
Object.Destroy(parent);
|
|
||||||
Object.Destroy(child);
|
|
||||||
Object.Destroy(grandChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")]
|
|
||||||
public void SetParent_ShouldSetParent()
|
|
||||||
{
|
|
||||||
var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
|
||||||
var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}};
|
|
||||||
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(null));
|
|
||||||
Assert.That(second.transform.parent, Is.EqualTo(null));
|
|
||||||
|
|
||||||
first.SetParent(second);
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(second.transform));
|
|
||||||
|
|
||||||
first.transform.SetParent(null!);
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(null));
|
|
||||||
|
|
||||||
second.SetParent(first);
|
|
||||||
Assert.That(second.transform.parent, Is.EqualTo(first.transform));
|
|
||||||
|
|
||||||
Object.Destroy(first);
|
|
||||||
Object.Destroy(second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1fde6c311eaec944abe1e4531a2980bc
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c906e39e3c8d44c7a8dafe042fedf677
|
|
||||||
timeCreated: 1652006420
|
|
@ -1,47 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class QuaternionTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void ToSystemQuaternion_ShouldReturnQuaternion_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
float w = random.NextSingle();
|
|
||||||
|
|
||||||
var quaternion = new Quaternion(x, y, z, w);
|
|
||||||
var systemQuaternion = quaternion.ToSystemQuaternion();
|
|
||||||
|
|
||||||
Assert.That(systemQuaternion.X, Is.EqualTo(quaternion.x).Within(1e-6f));
|
|
||||||
Assert.That(systemQuaternion.Y, Is.EqualTo(quaternion.y).Within(1e-6f));
|
|
||||||
Assert.That(systemQuaternion.Z, Is.EqualTo(quaternion.z).Within(1e-6f));
|
|
||||||
Assert.That(systemQuaternion.W, Is.EqualTo(quaternion.w).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityQuaternion_ShouldReturnQuaternion_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
float w = random.NextSingle();
|
|
||||||
|
|
||||||
var quaternion = new System.Numerics.Quaternion(x, y, z, w);
|
|
||||||
var unityQuaternion = quaternion.ToUnityQuaternion();
|
|
||||||
|
|
||||||
Assert.That(unityQuaternion.x, Is.EqualTo(quaternion.X).Within(1e-6f));
|
|
||||||
Assert.That(unityQuaternion.y, Is.EqualTo(quaternion.Y).Within(1e-6f));
|
|
||||||
Assert.That(unityQuaternion.z, Is.EqualTo(quaternion.Z).Within(1e-6f));
|
|
||||||
Assert.That(unityQuaternion.w, Is.EqualTo(quaternion.W).Within(1e-6f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a395fec41c5a4e9d9ffb05324e8159b0
|
|
||||||
timeCreated: 1652124913
|
|
@ -1,55 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class RandomTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void NextUnitVector2_ShouldReturnVector_WithMagnitude1()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var vector = random.NextUnitVector2();
|
|
||||||
Assert.That(vector.magnitude, Is.EqualTo(1).Within(1e-6));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextUnitVector2_ShouldThrow_GivenNullRandom()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextUnitVector2());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextUnitVector3_ShouldReturnVector_WithMagnitude1()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
var vector = random.NextUnitVector3();
|
|
||||||
Assert.That(vector.magnitude, Is.EqualTo(1).Within(1e-6));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextUnitVector3_ShouldThrow_GivenNullRandom()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextUnitVector3());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextRotation_ShouldThrow_GivenNullRandom()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextRotation());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void NextRotationUniform_ShouldThrow_GivenNullRandom()
|
|
||||||
{
|
|
||||||
Random random = null!;
|
|
||||||
Assert.Throws<ArgumentNullException>(() => random.NextRotationUniform());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 74577fe33f85446194c4ae2315caaace
|
|
||||||
timeCreated: 1652006301
|
|
@ -1,76 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class Vector2IntTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldReturnCorrectValues()
|
|
||||||
{
|
|
||||||
var vector = new Vector2Int(1, 2);
|
|
||||||
(int x, int y) = vector;
|
|
||||||
|
|
||||||
Assert.That(x, Is.EqualTo(1));
|
|
||||||
Assert.That(y, Is.EqualTo(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemPoint_ShouldReturnPoint_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
int x = random.Next();
|
|
||||||
int y = random.Next();
|
|
||||||
|
|
||||||
var vector = new Vector2Int(x, y);
|
|
||||||
var point = vector.ToSystemPoint();
|
|
||||||
|
|
||||||
Assert.That(point.X, Is.EqualTo(vector.x));
|
|
||||||
Assert.That(point.Y, Is.EqualTo(vector.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemSize_ShouldReturnSize_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
int x = random.Next();
|
|
||||||
int y = random.Next();
|
|
||||||
|
|
||||||
var vector = new Vector2Int(x, y);
|
|
||||||
var point = vector.ToSystemSize();
|
|
||||||
|
|
||||||
Assert.That(point.Width, Is.EqualTo(vector.x));
|
|
||||||
Assert.That(point.Height, Is.EqualTo(vector.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithX_ShouldReturnVectorWithNewX_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector2Int.one.WithX(0), Is.EqualTo(Vector2Int.up));
|
|
||||||
Assert.That(Vector2Int.zero.WithX(0), Is.EqualTo(Vector2Int.zero));
|
|
||||||
Assert.That(Vector2Int.right.WithX(0), Is.EqualTo(Vector2Int.zero));
|
|
||||||
Assert.That(Vector2Int.up.WithX(0), Is.EqualTo(Vector2Int.up));
|
|
||||||
|
|
||||||
Assert.That(Vector2Int.one.WithX(1), Is.EqualTo(Vector2Int.one));
|
|
||||||
Assert.That(Vector2Int.zero.WithX(1), Is.EqualTo(Vector2Int.right));
|
|
||||||
Assert.That(Vector2Int.right.WithX(1), Is.EqualTo(Vector2Int.right));
|
|
||||||
Assert.That(Vector2Int.up.WithX(1), Is.EqualTo(Vector2Int.one));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithY_ShouldReturnVectorWithNewY_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector2Int.one.WithY(0), Is.EqualTo(Vector2Int.right));
|
|
||||||
Assert.That(Vector2Int.zero.WithY(0), Is.EqualTo(Vector2Int.zero));
|
|
||||||
Assert.That(Vector2Int.right.WithY(0), Is.EqualTo(Vector2Int.right));
|
|
||||||
Assert.That(Vector2Int.up.WithY(0), Is.EqualTo(Vector2Int.zero));
|
|
||||||
|
|
||||||
Assert.That(Vector2Int.one.WithY(1), Is.EqualTo(Vector2Int.one));
|
|
||||||
Assert.That(Vector2Int.zero.WithY(1), Is.EqualTo(Vector2Int.up));
|
|
||||||
Assert.That(Vector2Int.right.WithY(1), Is.EqualTo(Vector2Int.one));
|
|
||||||
Assert.That(Vector2Int.up.WithY(1), Is.EqualTo(Vector2Int.up));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ad987e96afa849e6b0626ba7d7720f7b
|
|
||||||
timeCreated: 1653993201
|
|
@ -1,127 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class Vector2Tests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldReturnCorrectValues()
|
|
||||||
{
|
|
||||||
var vector = new Vector2(1, 2);
|
|
||||||
(float x, float y) = vector;
|
|
||||||
|
|
||||||
Assert.That(x, Is.EqualTo(1));
|
|
||||||
Assert.That(y, Is.EqualTo(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearestInteger_GivenNoParameters()
|
|
||||||
{
|
|
||||||
var vector = new Vector2(1.5f, 2.6f);
|
|
||||||
var rounded = vector.Round();
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(2));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearest10_GivenPrecision10()
|
|
||||||
{
|
|
||||||
var vector = new Vector2(1.5f, 25.2f);
|
|
||||||
var rounded = vector.Round(10);
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(0));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(30));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemPointF_ShouldReturnPoint_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new Vector2(x, y);
|
|
||||||
var point = vector.ToSystemPointF();
|
|
||||||
|
|
||||||
Assert.That(point.X, Is.EqualTo(vector.x).Within(1e-6f));
|
|
||||||
Assert.That(point.Y, Is.EqualTo(vector.y).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemSizeF_ShouldReturnSize_WithEquivalentMembers()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new Vector2(x, y);
|
|
||||||
var point = vector.ToSystemSizeF();
|
|
||||||
|
|
||||||
Assert.That(point.Width, Is.EqualTo(vector.x).Within(1e-6f));
|
|
||||||
Assert.That(point.Height, Is.EqualTo(vector.y).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new Vector2(x, y);
|
|
||||||
var systemVector = vector.ToSystemVector();
|
|
||||||
|
|
||||||
Assert.That(systemVector.Length(), Is.EqualTo(vector.magnitude).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.X, Is.EqualTo(vector.x).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.Y, Is.EqualTo(vector.y).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new System.Numerics.Vector2(x, y);
|
|
||||||
var unityVector = vector.ToUnityVector();
|
|
||||||
|
|
||||||
Assert.That(unityVector.magnitude, Is.EqualTo(vector.Length()).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.x, Is.EqualTo(vector.X).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.y, Is.EqualTo(vector.Y).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithX_ShouldReturnVectorWithNewX_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector2.one.WithX(0), Is.EqualTo(Vector2.up));
|
|
||||||
Assert.That(Vector2.zero.WithX(0), Is.EqualTo(Vector2.zero));
|
|
||||||
Assert.That(Vector2.right.WithX(0), Is.EqualTo(Vector2.zero));
|
|
||||||
Assert.That(Vector2.up.WithX(0), Is.EqualTo(Vector2.up));
|
|
||||||
|
|
||||||
Assert.That(Vector2.one.WithX(1), Is.EqualTo(Vector2.one));
|
|
||||||
Assert.That(Vector2.zero.WithX(1), Is.EqualTo(Vector2.right));
|
|
||||||
Assert.That(Vector2.right.WithX(1), Is.EqualTo(Vector2.right));
|
|
||||||
Assert.That(Vector2.up.WithX(1), Is.EqualTo(Vector2.one));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithY_ShouldReturnVectorWithNewY_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector2.one.WithY(0), Is.EqualTo(Vector2.right));
|
|
||||||
Assert.That(Vector2.zero.WithY(0), Is.EqualTo(Vector2.zero));
|
|
||||||
Assert.That(Vector2.right.WithY(0), Is.EqualTo(Vector2.right));
|
|
||||||
Assert.That(Vector2.up.WithY(0), Is.EqualTo(Vector2.zero));
|
|
||||||
|
|
||||||
Assert.That(Vector2.one.WithY(1), Is.EqualTo(Vector2.one));
|
|
||||||
Assert.That(Vector2.zero.WithY(1), Is.EqualTo(Vector2.up));
|
|
||||||
Assert.That(Vector2.right.WithY(1), Is.EqualTo(Vector2.one));
|
|
||||||
Assert.That(Vector2.up.WithY(1), Is.EqualTo(Vector2.up));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 83385270996049569380ae9769ff1381
|
|
||||||
timeCreated: 1652088132
|
|
@ -1,69 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class Vector3IntTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldReturnCorrectValues()
|
|
||||||
{
|
|
||||||
var vector = new Vector3Int(1, 2, 3);
|
|
||||||
(float x, float y, float z) = vector;
|
|
||||||
|
|
||||||
Assert.That(x, Is.EqualTo(1));
|
|
||||||
Assert.That(y, Is.EqualTo(2));
|
|
||||||
Assert.That(z, Is.EqualTo(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithX_ShouldReturnVectorWithNewX_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3Int.one.WithX(0), Is.EqualTo(new Vector3Int(0, 1, 1)));
|
|
||||||
Assert.That(Vector3Int.zero.WithX(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
Assert.That(Vector3Int.right.WithX(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
Assert.That(Vector3Int.up.WithX(0), Is.EqualTo(Vector3Int.up));
|
|
||||||
Assert.That(Vector3Int.forward.WithX(0), Is.EqualTo(Vector3Int.forward));
|
|
||||||
|
|
||||||
Assert.That(Vector3Int.one.WithX(1), Is.EqualTo(Vector3Int.one));
|
|
||||||
Assert.That(Vector3Int.zero.WithX(1), Is.EqualTo(Vector3Int.right));
|
|
||||||
Assert.That(Vector3Int.right.WithX(1), Is.EqualTo(Vector3Int.right));
|
|
||||||
Assert.That(Vector3Int.up.WithX(1), Is.EqualTo(new Vector3Int(1, 1, 0)));
|
|
||||||
Assert.That(Vector3Int.forward.WithX(1), Is.EqualTo(new Vector3Int(1, 0, 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithY_ShouldReturnVectorWithNewY_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3Int.one.WithY(0), Is.EqualTo(new Vector3Int(1, 0, 1)));
|
|
||||||
Assert.That(Vector3Int.zero.WithY(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
Assert.That(Vector3Int.right.WithY(0), Is.EqualTo(Vector3Int.right));
|
|
||||||
Assert.That(Vector3Int.up.WithY(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
Assert.That(Vector3Int.forward.WithY(0), Is.EqualTo(Vector3Int.forward));
|
|
||||||
|
|
||||||
Assert.That(Vector3Int.one.WithY(1), Is.EqualTo(Vector3Int.one));
|
|
||||||
Assert.That(Vector3Int.zero.WithY(1), Is.EqualTo(Vector3Int.up));
|
|
||||||
Assert.That(Vector3Int.right.WithY(1), Is.EqualTo(new Vector3Int(1, 1, 0)));
|
|
||||||
Assert.That(Vector3Int.up.WithY(1), Is.EqualTo(Vector3Int.up));
|
|
||||||
Assert.That(Vector3Int.forward.WithY(1), Is.EqualTo(new Vector3Int(0, 1, 1)));
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithZ_ShouldReturnVectorWithNewZ_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3Int.one.WithZ(0), Is.EqualTo(new Vector3Int(1, 1, 0)));
|
|
||||||
Assert.That(Vector3Int.zero.WithZ(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
Assert.That(Vector3Int.right.WithZ(0), Is.EqualTo(Vector3Int.right));
|
|
||||||
Assert.That(Vector3Int.up.WithZ(0), Is.EqualTo(Vector3Int.up));
|
|
||||||
Assert.That(Vector3Int.forward.WithZ(0), Is.EqualTo(Vector3Int.zero));
|
|
||||||
|
|
||||||
Assert.That(Vector3Int.one.WithZ(1), Is.EqualTo(Vector3Int.one));
|
|
||||||
Assert.That(Vector3Int.zero.WithZ(1), Is.EqualTo(Vector3Int.forward));
|
|
||||||
Assert.That(Vector3Int.right.WithZ(1), Is.EqualTo(new Vector3Int(1, 0, 1)));
|
|
||||||
Assert.That(Vector3Int.up.WithZ(1), Is.EqualTo(new Vector3Int(0, 1, 1)));
|
|
||||||
Assert.That(Vector3Int.forward.WithZ(1), Is.EqualTo(Vector3Int.forward));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e474d98fd3ee48159980aaa88040cfb3
|
|
||||||
timeCreated: 1653993371
|
|
@ -1,126 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class Vector3Tests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldReturnCorrectValues()
|
|
||||||
{
|
|
||||||
var vector = new Vector3(1, 2, 3);
|
|
||||||
(float x, float y, float z) = vector;
|
|
||||||
|
|
||||||
Assert.That(x, Is.EqualTo(1));
|
|
||||||
Assert.That(y, Is.EqualTo(2));
|
|
||||||
Assert.That(z, Is.EqualTo(3));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearestInteger_GivenNoParameters()
|
|
||||||
{
|
|
||||||
var vector = new Vector3(1.5f, 2.6f, -5.2f);
|
|
||||||
var rounded = vector.Round();
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(2));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(3));
|
|
||||||
Assert.That(rounded.z, Is.EqualTo(-5));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearest10_GivenPrecision10()
|
|
||||||
{
|
|
||||||
var vector = new Vector3(1.5f, 25.2f, -12.5f);
|
|
||||||
var rounded = vector.Round(10);
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(0));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(30));
|
|
||||||
Assert.That(rounded.z, Is.EqualTo(-10));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new Vector3(x, y, z);
|
|
||||||
var systemVector = vector.ToSystemVector();
|
|
||||||
|
|
||||||
Assert.That(systemVector.Length(), Is.EqualTo(vector.magnitude).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.X, Is.EqualTo(vector.x).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.Y, Is.EqualTo(vector.y).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.Z, Is.EqualTo(vector.z).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new System.Numerics.Vector3(x, y, z);
|
|
||||||
var unityVector = vector.ToUnityVector();
|
|
||||||
|
|
||||||
Assert.That(unityVector.magnitude, Is.EqualTo(vector.Length()).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.x, Is.EqualTo(vector.X).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.y, Is.EqualTo(vector.Y).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.z, Is.EqualTo(vector.Z).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithX_ShouldReturnVectorWithNewX_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3.one.WithX(0), Is.EqualTo(new Vector3(0, 1, 1)));
|
|
||||||
Assert.That(Vector3.zero.WithX(0), Is.EqualTo(Vector3.zero));
|
|
||||||
Assert.That(Vector3.right.WithX(0), Is.EqualTo(Vector3.zero));
|
|
||||||
Assert.That(Vector3.up.WithX(0), Is.EqualTo(Vector3.up));
|
|
||||||
Assert.That(Vector3.forward.WithX(0), Is.EqualTo(Vector3.forward));
|
|
||||||
|
|
||||||
Assert.That(Vector3.one.WithX(1), Is.EqualTo(Vector3.one));
|
|
||||||
Assert.That(Vector3.zero.WithX(1), Is.EqualTo(Vector3.right));
|
|
||||||
Assert.That(Vector3.right.WithX(1), Is.EqualTo(Vector3.right));
|
|
||||||
Assert.That(Vector3.up.WithX(1), Is.EqualTo(new Vector3(1, 1, 0)));
|
|
||||||
Assert.That(Vector3.forward.WithX(1), Is.EqualTo(new Vector3(1, 0, 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithY_ShouldReturnVectorWithNewY_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3.one.WithY(0), Is.EqualTo(new Vector3(1, 0, 1)));
|
|
||||||
Assert.That(Vector3.zero.WithY(0), Is.EqualTo(Vector3.zero));
|
|
||||||
Assert.That(Vector3.right.WithY(0), Is.EqualTo(Vector3.right));
|
|
||||||
Assert.That(Vector3.up.WithY(0), Is.EqualTo(Vector3.zero));
|
|
||||||
Assert.That(Vector3.forward.WithY(0), Is.EqualTo(Vector3.forward));
|
|
||||||
|
|
||||||
Assert.That(Vector3.one.WithY(1), Is.EqualTo(Vector3.one));
|
|
||||||
Assert.That(Vector3.zero.WithY(1), Is.EqualTo(Vector3.up));
|
|
||||||
Assert.That(Vector3.right.WithY(1), Is.EqualTo(new Vector3(1, 1, 0)));
|
|
||||||
Assert.That(Vector3.up.WithY(1), Is.EqualTo(Vector3.up));
|
|
||||||
Assert.That(Vector3.forward.WithY(1), Is.EqualTo(new Vector3(0, 1, 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithZ_ShouldReturnVectorWithNewZ_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector3.one.WithZ(0), Is.EqualTo(new Vector3(1, 1, 0)));
|
|
||||||
Assert.That(Vector3.zero.WithZ(0), Is.EqualTo(Vector3.zero));
|
|
||||||
Assert.That(Vector3.right.WithZ(0), Is.EqualTo(Vector3.right));
|
|
||||||
Assert.That(Vector3.up.WithZ(0), Is.EqualTo(Vector3.up));
|
|
||||||
Assert.That(Vector3.forward.WithZ(0), Is.EqualTo(Vector3.zero));
|
|
||||||
|
|
||||||
Assert.That(Vector3.one.WithZ(1), Is.EqualTo(Vector3.one));
|
|
||||||
Assert.That(Vector3.zero.WithZ(1), Is.EqualTo(Vector3.forward));
|
|
||||||
Assert.That(Vector3.right.WithZ(1), Is.EqualTo(new Vector3(1, 0, 1)));
|
|
||||||
Assert.That(Vector3.up.WithZ(1), Is.EqualTo(new Vector3(0, 1, 1)));
|
|
||||||
Assert.That(Vector3.forward.WithZ(1), Is.EqualTo(Vector3.forward));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a00d613201bd497d91c9e98bca8dd6b1
|
|
||||||
timeCreated: 1652088132
|
|
@ -1,157 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using X10D.Core;
|
|
||||||
using X10D.Unity.Numerics;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests.Numerics
|
|
||||||
{
|
|
||||||
public class Vector4Tests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Deconstruct_ShouldReturnCorrectValues()
|
|
||||||
{
|
|
||||||
var vector = new Vector4(1, 2, 3, 4);
|
|
||||||
(float x, float y, float z, float w) = vector;
|
|
||||||
|
|
||||||
Assert.That(x, Is.EqualTo(1));
|
|
||||||
Assert.That(y, Is.EqualTo(2));
|
|
||||||
Assert.That(z, Is.EqualTo(3));
|
|
||||||
Assert.That(w, Is.EqualTo(4));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearestInteger_GivenNoParameters()
|
|
||||||
{
|
|
||||||
var vector = new Vector4(1.5f, 2.6f, -5.2f, 0.3f);
|
|
||||||
var rounded = vector.Round();
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(2));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(3));
|
|
||||||
Assert.That(rounded.z, Is.EqualTo(-5));
|
|
||||||
Assert.That(rounded.w, Is.EqualTo(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Round_ShouldRoundToNearest10_GivenPrecision10()
|
|
||||||
{
|
|
||||||
var vector = new Vector4(1.5f, 25.2f, -12.5f, 101.2f);
|
|
||||||
var rounded = vector.Round(10);
|
|
||||||
|
|
||||||
Assert.That(rounded.x, Is.EqualTo(0));
|
|
||||||
Assert.That(rounded.y, Is.EqualTo(30));
|
|
||||||
Assert.That(rounded.z, Is.EqualTo(-10));
|
|
||||||
Assert.That(rounded.w, Is.EqualTo(100));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToSystemVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
float w = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new Vector4(x, y, z, w);
|
|
||||||
var systemVector = vector.ToSystemVector();
|
|
||||||
|
|
||||||
Assert.That(systemVector.Length(), Is.EqualTo(vector.magnitude).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.X, Is.EqualTo(vector.x).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.Y, Is.EqualTo(vector.y).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.Z, Is.EqualTo(vector.z).Within(1e-6f));
|
|
||||||
Assert.That(systemVector.W, Is.EqualTo(vector.w).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void ToUnityVector_ShouldReturnVector_WithEqualComponents()
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
float x = random.NextSingle();
|
|
||||||
float y = random.NextSingle();
|
|
||||||
float z = random.NextSingle();
|
|
||||||
float w = random.NextSingle();
|
|
||||||
|
|
||||||
var vector = new System.Numerics.Vector4(x, y, z, w);
|
|
||||||
var unityVector = vector.ToUnityVector();
|
|
||||||
|
|
||||||
Assert.That(unityVector.magnitude, Is.EqualTo(vector.Length()).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.x, Is.EqualTo(vector.X).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.y, Is.EqualTo(vector.Y).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.z, Is.EqualTo(vector.Z).Within(1e-6f));
|
|
||||||
Assert.That(unityVector.w, Is.EqualTo(vector.W).Within(1e-6f));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithW_ShouldReturnVectorWithNewW_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector4.one.WithW(0), Is.EqualTo(new Vector4(1, 1, 1, 0)));
|
|
||||||
Assert.That(Vector4.zero.WithW(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithW(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithW(0), Is.EqualTo(new Vector4(1, 0, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithW(0), Is.EqualTo(new Vector4(0, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithW(0), Is.EqualTo(new Vector4(0, 0, 1, 0)));
|
|
||||||
|
|
||||||
Assert.That(Vector4.one.WithW(1), Is.EqualTo(Vector4.one));
|
|
||||||
Assert.That(Vector4.zero.WithW(1), Is.EqualTo(new Vector4(0, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithW(1), Is.EqualTo(new Vector4(0, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithW(1), Is.EqualTo(new Vector4(1, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithW(1), Is.EqualTo(new Vector4(0, 1, 0, 1)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithW(1), Is.EqualTo(new Vector4(0, 0, 1, 1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithX_ShouldReturnVectorWithNewX_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector4.one.WithX(0), Is.EqualTo(new Vector4(0, 1, 1, 1)));
|
|
||||||
Assert.That(Vector4.zero.WithX(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithX(0), Is.EqualTo(new Vector4(0, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithX(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithX(0), Is.EqualTo(new Vector4(0, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithX(0), Is.EqualTo(new Vector4(0, 0, 1, 0)));
|
|
||||||
|
|
||||||
Assert.That(Vector4.one.WithX(1), Is.EqualTo(Vector4.one));
|
|
||||||
Assert.That(Vector4.zero.WithX(1), Is.EqualTo(new Vector4(1, 0, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithX(1), Is.EqualTo(new Vector4(1, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithX(1), Is.EqualTo(new Vector4(1, 0, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithX(1), Is.EqualTo(new Vector4(1, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithX(1), Is.EqualTo(new Vector4(1, 0, 1, 0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithY_ShouldReturnVectorWithNewY_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector4.one.WithY(0), Is.EqualTo(new Vector4(1, 0, 1, 1)));
|
|
||||||
Assert.That(Vector4.zero.WithY(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithY(0), Is.EqualTo(new Vector4(0, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithY(0), Is.EqualTo(new Vector4(1, 0, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithY(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithY(0), Is.EqualTo(new Vector4(0, 0, 1, 0)));
|
|
||||||
|
|
||||||
Assert.That(Vector4.one.WithY(1), Is.EqualTo(Vector4.one));
|
|
||||||
Assert.That(Vector4.zero.WithY(1), Is.EqualTo(new Vector4(0, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithY(1), Is.EqualTo(new Vector4(0, 1, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithY(1), Is.EqualTo(new Vector4(1, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithY(1), Is.EqualTo(new Vector4(0, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithY(1), Is.EqualTo(new Vector4(0, 1, 1, 0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void WithZ_ShouldReturnVectorWithNewZ_GivenVector()
|
|
||||||
{
|
|
||||||
Assert.That(Vector4.one.WithZ(0), Is.EqualTo(new Vector4(1, 1, 0, 1)));
|
|
||||||
Assert.That(Vector4.zero.WithZ(0), Is.EqualTo(Vector4.zero));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithZ(0), Is.EqualTo(new Vector4(0, 0, 0, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithZ(0), Is.EqualTo(new Vector4(1, 0, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithZ(0), Is.EqualTo(new Vector4(0, 1, 0, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithZ(0), Is.EqualTo(Vector4.zero));
|
|
||||||
|
|
||||||
Assert.That(Vector4.one.WithZ(1), Is.EqualTo(Vector4.one));
|
|
||||||
Assert.That(Vector4.zero.WithZ(1), Is.EqualTo(new Vector4(0, 0, 1, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 0, 1).WithZ(1), Is.EqualTo(new Vector4(0, 0, 1, 1)));
|
|
||||||
Assert.That(new Vector4(1, 0, 0, 0).WithZ(1), Is.EqualTo(new Vector4(1, 0, 1, 0)));
|
|
||||||
Assert.That(new Vector4(0, 1, 0, 0).WithZ(1), Is.EqualTo(new Vector4(0, 1, 1, 0)));
|
|
||||||
Assert.That(new Vector4(0, 0, 1, 0).WithZ(1), Is.EqualTo(new Vector4(0, 0, 1, 0)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0d487c2046a64354b199f4de01d57391
|
|
||||||
timeCreated: 1652088132
|
|
@ -1,43 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.TestTools;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
public class SingletonTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void Singleton_ShouldReturnNewInstance_WhenNoInstanceExists()
|
|
||||||
{
|
|
||||||
TestBehaviour instance = Singleton<TestBehaviour>.Instance;
|
|
||||||
Assert.That(instance, Is.Not.Null);
|
|
||||||
Assert.That(instance.Flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Singleton_ShouldReturnSameInstance_WhenAccessedTwice()
|
|
||||||
{
|
|
||||||
TestBehaviour instance = Singleton<TestBehaviour>.Instance;
|
|
||||||
Assert.That(instance, Is.Not.Null);
|
|
||||||
Assert.That(Singleton<TestBehaviour>.Instance, Is.EqualTo(instance));
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnityTest]
|
|
||||||
public IEnumerator Singleton_ShouldReturnNewInstance_WhenDestroyed()
|
|
||||||
{
|
|
||||||
TestBehaviour instance = Singleton<TestBehaviour>.Instance;
|
|
||||||
Assert.That(instance, Is.Not.Null);
|
|
||||||
Object.Destroy(instance);
|
|
||||||
|
|
||||||
yield return null;
|
|
||||||
|
|
||||||
Assert.IsFalse(instance);
|
|
||||||
|
|
||||||
// ReSharper disable once HeuristicUnreachableCode
|
|
||||||
instance = Singleton<TestBehaviour>.Instance;
|
|
||||||
Assert.That(instance, Is.Not.Null);
|
|
||||||
Assert.IsTrue(instance.Flag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5c51198d124f40859bd9298d3241d5a6
|
|
||||||
timeCreated: 1652428949
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
internal sealed class TestBehaviour : Singleton<TestBehaviour>
|
|
||||||
{
|
|
||||||
public bool Flag
|
|
||||||
{
|
|
||||||
get => true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: df932718d20948ecbe9b0de8aa7bbaf4
|
|
||||||
timeCreated: 1652428898
|
|
@ -1,59 +0,0 @@
|
|||||||
#nullable enable
|
|
||||||
|
|
||||||
using System.Collections;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.TestTools;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
public class TransformTests
|
|
||||||
{
|
|
||||||
[UnityTest]
|
|
||||||
public IEnumerator LookAt_ShouldRotateSameAsTransform()
|
|
||||||
{
|
|
||||||
var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
|
||||||
var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}};
|
|
||||||
Transform firstTransform = first.transform;
|
|
||||||
Transform secondTransform = second.transform;
|
|
||||||
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
Assert.That(secondTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
firstTransform.LookAt(secondTransform);
|
|
||||||
Quaternion expected = firstTransform.rotation;
|
|
||||||
|
|
||||||
firstTransform.rotation = Quaternion.identity;
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
firstTransform.LookAt(second);
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(expected));
|
|
||||||
|
|
||||||
firstTransform.rotation = Quaternion.identity;
|
|
||||||
Assert.That(firstTransform.rotation, Is.EqualTo(Quaternion.identity));
|
|
||||||
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnityTest]
|
|
||||||
public IEnumerator SetParent_ShouldSetParent()
|
|
||||||
{
|
|
||||||
var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
|
||||||
var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}};
|
|
||||||
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(null));
|
|
||||||
Assert.That(second.transform.parent, Is.EqualTo(null));
|
|
||||||
|
|
||||||
first.transform.SetParent(second);
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(second.transform));
|
|
||||||
|
|
||||||
first.transform.SetParent(null!);
|
|
||||||
Assert.That(first.transform.parent, Is.EqualTo(null));
|
|
||||||
|
|
||||||
second.transform.SetParent(first);
|
|
||||||
Assert.That(second.transform.parent, Is.EqualTo(first.transform));
|
|
||||||
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1f1518cdf51546288b7a16369297be5e
|
|
||||||
timeCreated: 1652005981
|
|
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "X10D.Unity.Tests",
|
|
||||||
"rootNamespace": "X10D.Unity",
|
|
||||||
"references": [
|
|
||||||
"UnityEngine.TestRunner",
|
|
||||||
"UnityEditor.TestRunner"
|
|
||||||
],
|
|
||||||
"includePlatforms": [],
|
|
||||||
"excludePlatforms": [],
|
|
||||||
"allowUnsafeCode": false,
|
|
||||||
"overrideReferences": true,
|
|
||||||
"precompiledReferences": [
|
|
||||||
"nunit.framework.dll",
|
|
||||||
"X10D.dll",
|
|
||||||
"X10D.Unity.dll"
|
|
||||||
],
|
|
||||||
"autoReferenced": false,
|
|
||||||
"defineConstraints": [
|
|
||||||
"UNITY_INCLUDE_TESTS"
|
|
||||||
],
|
|
||||||
"versionDefines": [],
|
|
||||||
"noEngineReferences": false
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 34215b8a0b1faf64487ff72821603aad
|
|
||||||
AssemblyDefinitionImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
|
||||||
{
|
|
||||||
public class YieldInstructionIntegrationTests : MonoBehaviour
|
|
||||||
{
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
StartCoroutine(CO_WaitForAnyKeyDown());
|
|
||||||
StartCoroutine(CO_WaitForSpaceKeyDown());
|
|
||||||
StartCoroutine(CO_WaitForSpaceKeyUp());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator CO_WaitForAnyKeyDown()
|
|
||||||
{
|
|
||||||
Debug.Log("Waiting for any key to be pressed...");
|
|
||||||
yield return new WaitForKeyDown();
|
|
||||||
Debug.Log("Key was pressed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator CO_WaitForSpaceKeyDown()
|
|
||||||
{
|
|
||||||
Debug.Log("Waiting for Space key to be pressed...");
|
|
||||||
yield return new WaitForKeyDown(KeyCode.Space);
|
|
||||||
Debug.Log("Space key was pressed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator CO_WaitForSpaceKeyUp()
|
|
||||||
{
|
|
||||||
Debug.Log("Waiting for Space key to be released...");
|
|
||||||
yield return new WaitForKeyUp(KeyCode.Space);
|
|
||||||
Debug.Log("Space key was released!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 67d53e2f993d4a5ba0eb34431d1846cd
|
|
||||||
timeCreated: 1657791682
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user