Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
4bb35292
Commit
4bb35292
authored
Sep 04, 2013
by
Vinicius Jarina
Browse files
Added LoadBinary test.
parent
9e33e833
Changes
3
Hide whitespace changes
Inline
Side-by-side
NLuaTest/LoadFileTests.cs
View file @
4bb35292
...
@@ -58,63 +58,37 @@ namespace LoadFileTests
...
@@ -58,63 +58,37 @@ namespace LoadFileTests
}
}
}
}
[
Test
]
[
Test
]
public
void
TestBinaryLoadFile
()
public
void
TestBinaryLoadFile
()
{
{
// using (Lua lua = new Lua ()) {
using
(
Lua
lua
=
new
Lua
())
{
// lua.LoadCLRPackage ();
lua
.
LoadCLRPackage
();
//
if
(
IntPtr
.
Size
==
4
)
// lua.LoadFile ("test.luac");
lua
.
DoFile
(
"test_32.luac"
);
//
else
// int width = (int)(double)lua ["width"];
lua
.
DoFile
(
"test_64.luac"
);
// int height = (int)(double)lua ["height"];
// string message = (string)lua ["message"];
int
width
=
(
int
)(
double
)
lua
[
"width"
];
// int color_g = (int)(double)lua ["color.g"];
int
height
=
(
int
)(
double
)
lua
[
"height"
];
// LuaFunction func = (LuaFunction)lua ["func"];
string
message
=
(
string
)
lua
[
"message"
];
// object[] res = func.Call (12, 34);
int
color_g
=
(
int
)(
double
)
lua
[
"color.g"
];
// int x = (int)(double)res [0];
LuaFunction
func
=
(
LuaFunction
)
lua
[
"func"
];
// int y = (int)(double)res [1];
object
[]
res
=
func
.
Call
(
12
,
34
);
// //function func(x,y)
int
x
=
(
int
)(
double
)
res
[
0
];
// // return x,x+y
int
y
=
(
int
)(
double
)
res
[
1
];
// //end
//function func(x,y)
//
// return x,x+y
// Assert.AreEqual (100, width);
//end
// Assert.AreEqual (200, height);
// Assert.AreEqual ("Hello World!", message);
// Assert.AreEqual (20, color_g);
// Assert.AreEqual (12, x);
// Assert.AreEqual (46, y);
// }
}
// [Test]
Assert
.
AreEqual
(
100
,
width
);
// public void TestBinaryLoadFile ()
Assert
.
AreEqual
(
200
,
height
);
// {
Assert
.
AreEqual
(
"Hello World!"
,
message
);
// using (Lua lua = new Lua ()) {
Assert
.
AreEqual
(
20
,
color_g
);
// lua.LoadCLRPackage ();
Assert
.
AreEqual
(
12
,
x
);
//
Assert
.
AreEqual
(
46
,
y
);
// lua.LoadFile ("test.luac");
}
//
}
// int width = (int)(double)lua ["width"];
// int height = (int)(double)lua ["height"];
// string message = (string)lua ["message"];
// int color_g = (int)(double)lua ["color.g"];
// LuaFunction func = (LuaFunction)lua ["func"];
// object[] res = func.Call (12, 34);
// int x = (int)(double)res [0];
// int y = (int)(double)res [1];
// //function func(x,y)
// // return x,x+y
// //end
//
// Assert.AreEqual (100, width);
// Assert.AreEqual (200, height);
// Assert.AreEqual ("Hello World!", message);
// Assert.AreEqual (20, color_g);
// Assert.AreEqual (12, x);
// Assert.AreEqual (46, y);
// }
// }
}
}
}
}
tests/test_32.luac
0 → 100644
View file @
4bb35292
File added
tests/test_64.luac
0 → 100644
View file @
4bb35292
File added
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