add Attribute definition
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

Updates #2.
This commit is contained in:
2023-07-23 14:18:29 -05:00
committed by zephyr
parent bf19a9e50e
commit 08b2f22052
9 changed files with 138 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
public class AttributeTest
{
[Test]
[TestCase(1000000, 0, 0, 0, 0, ExpectedResult = 1000000)]
[TestCase(1000000, 1, 0, 0, 0, ExpectedResult = 1000001)]
[TestCase(1000000, 0, 2, 0, 0, ExpectedResult = 1000002)]
[TestCase(1000000, 0, 0, 10000, 0, ExpectedResult = 2000000)]
[TestCase(1000000, 0, 0, 0, 3, ExpectedResult = 1000003)]
[TestCase(0, 1000000, 1000000, 5000, 1000, ExpectedResult = 3001000)]
[TestCase(1000000, 0, 0, -10000, 0, ExpectedResult = 0)]
[TestCase(1000000, 0, 0, -20000, 0, ExpectedResult = 0)]
[TestCase(1000000, 0, 0, -20000, 50, ExpectedResult = 0)]
public long Calc(long startStat, long levelUp, long baseBonus, long permyriadBonus, long flatBonus)
{
var attr = new Attribute(startStat);
attr.LevelUp(levelUp);
return attr.Calc(baseBonus, permyriadBonus, flatBonus);
}
}

11
Assets/Tests/AttributeTest.cs.meta generated Normal file
View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d4d405f62d1e7dc4aaf451051bf27d73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

24
Assets/Tests/Tests.asmdef Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "Tests",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"IdleSurvivors"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

7
Assets/Tests/Tests.asmdef.meta generated Normal file
View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0e24b24d5798c7c4b979b314b1a7afce
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: