Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
ButtonPusher
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Button Pusher
ButtonPusher
Commits
328afc85
Commit
328afc85
authored
7 years ago
by
16이상민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write tests for class "NoteMaker"
parent
692c0e7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
224 additions
and
1 deletion
+224
-1
NoteMakerTests.cs
Assets/Editor/NoteMakerTests.cs
+209
-0
NoteMakerTests.cs.meta
Assets/Editor/NoteMakerTests.cs.meta
+13
-0
ButtonNoteMaker.cs
Assets/TrackAnalysis/ButtonNoteMaker.cs
+2
-1
No files found.
Assets/Editor/NoteMakerTests.cs
0 → 100644
View file @
328afc85
using
TrackAnalysis
;
using
NUnit.Framework
;
class
NoteMakerTests
{
[
Test
]
public
void
Made_Note_Should_Null_When_Note_Type_SBT_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
note
=
obj
.
Make
(
"CP"
,
"SBT"
,
0
);
var
expected
=
true
;
var
actual
=
(
note
==
null
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be null value when note type is SBT and code is CP"
);
}
[
Test
]
public
void
Made_Note_Should_Null_When_Note_Type_SMO_Code_AA
()
{
var
obj
=
new
NoteMaker
();
var
note
=
obj
.
Make
(
"AA"
,
"SMO"
,
0
);
var
expected
=
true
;
var
actual
=
(
note
==
null
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be null value when note type is SMO and code is AA"
);
}
[
Test
]
public
void
Made_Note_Should_Short_When_Note_Type_SBT
()
{
var
obj
=
new
NoteMaker
();
var
note
=
obj
.
Make
(
"AA"
,
"SBT"
,
0
);
var
expected
=
true
;
var
actual
=
(
note
.
Type
==
NoteType
.
SBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be short when note type is SBT"
);
}
[
Test
]
public
void
Made_Note_Should_Long_When_Note_Type_LBT
()
{
var
obj
=
new
NoteMaker
();
var
tmp
=
obj
.
Make
(
"AA"
,
"LBT"
,
0
);
var
note
=
obj
.
Make
(
"AA"
,
"LBT"
,
1
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note
.
Type
==
NoteType
.
LBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be long when note type is LBT"
);
}
[
Test
]
public
void
Made_Note_Should_Short_When_Note_Type_SMO_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
note
=
obj
.
Make
(
"CP"
,
"SMO"
,
0
);
var
expected
=
true
;
var
actual
=
(
note
.
Type
==
NoteType
.
SMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be short when note type is SMO and code is CP"
);
}
[
Test
]
public
void
Made_Note_Should_Long_When_Note_Type_LMO_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
tmp
=
obj
.
Make
(
"CP"
,
"LMO"
,
0
);
var
note
=
obj
.
Make
(
"CP"
,
"LMO"
,
1
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note
.
Type
==
NoteType
.
LMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"Made note should be long when note type is LMO and code is CP"
);
}
[
Test
]
public
void
Short_Short_Should_Made_Correctly
()
{
var
obj
=
new
NoteMaker
();
var
note1
=
obj
.
Make
(
"AA"
,
"SBT"
,
0
);
var
note2
=
obj
.
Make
(
"AA"
,
"SBT"
,
1
);
var
expected
=
true
;
var
actual
=
(
note1
.
Type
==
NoteType
.
SBT
&&
note2
.
Type
==
NoteType
.
SBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"2 short notes should be made correctly"
);
}
[
Test
]
public
void
Short_Long_Should_Made_Correctly
()
{
var
obj
=
new
NoteMaker
();
var
note1
=
obj
.
Make
(
"AA"
,
"SBT"
,
0
);
var
tmp
=
obj
.
Make
(
"AA"
,
"LBT"
,
1
);
var
note2
=
obj
.
Make
(
"AA"
,
"LBT"
,
2
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note1
.
Type
==
NoteType
.
SBT
&&
note2
.
Type
==
NoteType
.
LBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"The short next long note should be made correctly"
);
}
[
Test
]
public
void
Long_Short_Should_Made_Correctly
()
{
var
obj
=
new
NoteMaker
();
var
tmp
=
obj
.
Make
(
"AA"
,
"LBT"
,
0
);
var
note1
=
obj
.
Make
(
"AA"
,
"LBT"
,
1
);
var
note2
=
obj
.
Make
(
"AA"
,
"SBT"
,
2
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note1
.
Type
==
NoteType
.
LBT
&&
note2
.
Type
==
NoteType
.
SBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"The long next short note should be made correctly"
);
}
[
Test
]
public
void
Long_Long_Should_Made_Correctly
()
{
var
obj
=
new
NoteMaker
();
var
tmp1
=
obj
.
Make
(
"AA"
,
"LBT"
,
0
);
var
note1
=
obj
.
Make
(
"AA"
,
"LBT"
,
1
);
var
tmp2
=
obj
.
Make
(
"AA"
,
"LBT"
,
2
);
var
note2
=
obj
.
Make
(
"AA"
,
"LBT"
,
3
);
var
expected
=
true
;
var
actual
=
(
tmp1
==
null
&&
tmp2
==
null
&&
note1
.
Type
==
NoteType
.
LBT
&&
note2
.
Type
==
NoteType
.
LBT
);
Assert
.
AreEqual
(
expected
,
actual
,
"2 long notes should be made correctly"
);
}
[
Test
]
public
void
Short_Short_Should_Made_Correctly_When_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
note1
=
obj
.
Make
(
"CP"
,
"SMO"
,
0
);
var
note2
=
obj
.
Make
(
"CP"
,
"SMO"
,
1
);
var
expected
=
true
;
var
actual
=
(
note1
.
Type
==
NoteType
.
SMO
&&
note2
.
Type
==
NoteType
.
SMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"2 short notes should be made correctly when code is cp"
);
}
[
Test
]
public
void
Short_Long_Should_Made_Correctly_When_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
note1
=
obj
.
Make
(
"CP"
,
"SMO"
,
0
);
var
tmp
=
obj
.
Make
(
"CP"
,
"LMO"
,
1
);
var
note2
=
obj
.
Make
(
"CP"
,
"LMO"
,
2
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note1
.
Type
==
NoteType
.
SMO
&&
note2
.
Type
==
NoteType
.
LMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"The short next long note should be made correctly when code is cp"
);
}
[
Test
]
public
void
Long_Short_Should_Made_Correctly_When_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
tmp
=
obj
.
Make
(
"CP"
,
"LMO"
,
0
);
var
note1
=
obj
.
Make
(
"CP"
,
"LMO"
,
1
);
var
note2
=
obj
.
Make
(
"CP"
,
"SMO"
,
2
);
var
expected
=
true
;
var
actual
=
(
tmp
==
null
&&
note1
.
Type
==
NoteType
.
LMO
&&
note2
.
Type
==
NoteType
.
SMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"The long next short note should be made correctly when code is cp"
);
}
[
Test
]
public
void
Long_Long_Should_Made_Correctly_When_Code_CP
()
{
var
obj
=
new
NoteMaker
();
var
tmp1
=
obj
.
Make
(
"CP"
,
"LMO"
,
0
);
var
note1
=
obj
.
Make
(
"CP"
,
"LMO"
,
1
);
var
tmp2
=
obj
.
Make
(
"CP"
,
"LMO"
,
2
);
var
note2
=
obj
.
Make
(
"CP"
,
"LMO"
,
3
);
var
expected
=
true
;
var
actual
=
(
tmp1
==
null
&&
tmp2
==
null
&&
note1
.
Type
==
NoteType
.
LMO
&&
note2
.
Type
==
NoteType
.
LMO
);
Assert
.
AreEqual
(
expected
,
actual
,
"2 long notes should be made correctly when code is cp"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Assets/Editor/NoteMakerTests.cs.meta
0 → 100644
View file @
328afc85
fileFormatVersion: 2
guid: 79bd0ea5146198b458d772a4f8d24253
timeCreated: 1518227964
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
Click to expand it.
Assets/TrackAnalysis/ButtonNoteMaker.cs
View file @
328afc85
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
string
type
,
string
type
,
string
code
)
string
code
)
{
{
return
type
.
Substring
(
1
)
!=
"BT"
;
return
type
.
Substring
(
1
)
!=
"BT"
||
code
!=
"AA"
;
}
}
override
protected
override
protected
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment