Skip to content

Commit f698f5d

Browse files
committed
restructuring unit tests
1 parent b60b78e commit f698f5d

22 files changed

+52
-76
lines changed

tests/HydraScript.UnitTests/Unit/IR/FunctionWithUndefinedReturnStorageTests.cs renamed to tests/HydraScript.UnitTests/Application/FunctionWithUndefinedReturnStorageTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using HydraScript.Application.StaticAnalysis;
22
using HydraScript.Application.StaticAnalysis.Impl;
33
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Declarations;
4+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Declarations.AfterTypesAreLoaded;
5+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Expressions.PrimaryExpressions;
6+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Statements;
47
using HydraScript.Domain.IR.Impl.Symbols;
5-
using Xunit;
6-
using BlockStatement = HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Statements.BlockStatement;
7-
using FunctionDeclaration = HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Declarations.AfterTypesAreLoaded.FunctionDeclaration;
8-
using IdentifierReference = HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Expressions.PrimaryExpressions.IdentifierReference;
98

10-
namespace HydraScript.UnitTests.Unit.IR;
9+
namespace HydraScript.UnitTests.Application;
1110

1211
public class FunctionWithUndefinedReturnStorageTests
1312
{

tests/HydraScript.UnitTests/Unit/IR/SymbolTableTests.cs renamed to tests/HydraScript.UnitTests/Application/SymbolTableTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using HydraScript.Domain.IR;
22
using HydraScript.Domain.IR.Impl;
3-
using Xunit;
43

5-
namespace HydraScript.UnitTests.Unit.IR;
4+
namespace HydraScript.UnitTests.Application;
65

76
public class SymbolTableTests
87
{

tests/HydraScript.UnitTests/Unit/BackEnd/AddressedInstructionsTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/AddressedInstructionsTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
using HydraScript.Domain.BackEnd.Impl.Instructions;
44
using HydraScript.Domain.BackEnd.Impl.Instructions.WithAssignment;
55
using HydraScript.Domain.BackEnd.Impl.Values;
6-
using Xunit;
76

8-
namespace HydraScript.UnitTests.Unit.BackEnd;
7+
namespace HydraScript.UnitTests.Domain.BackEnd;
98

109
public class AddressedInstructionsTests
1110
{

tests/HydraScript.UnitTests/Unit/BackEnd/CallTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/CallTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using HydraScript.Domain.BackEnd;
22
using HydraScript.Domain.BackEnd.Impl.Addresses;
3-
using Xunit;
43

5-
namespace HydraScript.UnitTests.Unit.BackEnd;
4+
namespace HydraScript.UnitTests.Domain.BackEnd;
65

76
public class CallTests
87
{

tests/HydraScript.UnitTests/Unit/BackEnd/HashAddressTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/HashAddressTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using HydraScript.Domain.BackEnd.Impl.Addresses;
2-
using Xunit;
32

4-
namespace HydraScript.UnitTests.Unit.BackEnd;
3+
namespace HydraScript.UnitTests.Domain.BackEnd;
54

65
public class HashAddressTests
76
{

tests/HydraScript.UnitTests/TestData/InstructionsData.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/InstructionsData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using HydraScript.Domain.BackEnd.Impl.Instructions.WithJump;
99
using HydraScript.Domain.BackEnd.Impl.Values;
1010

11-
namespace HydraScript.UnitTests.TestData;
11+
namespace HydraScript.UnitTests.Domain.BackEnd;
1212

1313
public class InstructionsData : IEnumerable<object[]>
1414
{

tests/HydraScript.UnitTests/Unit/BackEnd/InstructionsTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/InstructionsTests.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using HydraScript.Domain.BackEnd;
22
using HydraScript.Domain.BackEnd.Impl.Addresses;
33
using HydraScript.Domain.BackEnd.Impl.Instructions.WithJump;
4-
using HydraScript.UnitTests.TestData;
5-
using Xunit;
64

7-
namespace HydraScript.UnitTests.Unit.BackEnd;
5+
namespace HydraScript.UnitTests.Domain.BackEnd;
86

97
public class InstructionsTests
108
{

tests/HydraScript.UnitTests/Unit/BackEnd/ValuesTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/ValuesTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using HydraScript.Domain.BackEnd.Impl.Values;
2-
using Xunit;
32

4-
namespace HydraScript.UnitTests.Unit.BackEnd;
3+
namespace HydraScript.UnitTests.Domain.BackEnd;
54

65
public class ValuesTests
76
{

tests/HydraScript.UnitTests/Unit/BackEnd/VirtualMachineTests.cs renamed to tests/HydraScript.UnitTests/Domain/BackEnd/VirtualMachineTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
using HydraScript.Domain.BackEnd.Impl.Instructions.WithAssignment.ComplexData.Write;
88
using HydraScript.Domain.BackEnd.Impl.Instructions.WithJump;
99
using HydraScript.Domain.BackEnd.Impl.Values;
10-
using Xunit;
1110

12-
namespace HydraScript.UnitTests.Unit.BackEnd;
11+
namespace HydraScript.UnitTests.Domain.BackEnd;
1312

1413
public class VirtualMachineTests
1514
{
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes;
2+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Declarations;
3+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Declarations.AfterTypesAreLoaded;
4+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Expressions.PrimaryExpressions;
5+
using HydraScript.Domain.FrontEnd.Parser.Impl.Ast.Nodes.Statements;
6+
7+
namespace HydraScript.UnitTests.Domain.FrontEnd;
8+
9+
public class AstNodeTests
10+
{
11+
[Fact]
12+
public void PrecedenceTest()
13+
{
14+
var lexicalDecl = new LexicalDeclaration(false);
15+
List<StatementListItem> stmtItemList = [lexicalDecl];
16+
// ReSharper disable once UnusedVariable
17+
var func = new FunctionDeclaration(
18+
name: new IdentifierReference(name: Guid.NewGuid().ToString()),
19+
new TypeIdentValue(
20+
TypeId: new IdentifierReference(
21+
name: Guid.NewGuid().ToString())),
22+
arguments: [],
23+
new BlockStatement(stmtItemList));
24+
25+
_ = new ScriptBody([func]);
26+
27+
Assert.True(lexicalDecl.ChildOf<FunctionDeclaration>());
28+
Assert.False(lexicalDecl.ChildOf<Literal>());
29+
}
30+
}

0 commit comments

Comments
 (0)