Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start a test project using NUnit framework
- Loading branch information
Showing
8 changed files
with
95 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using NUnit.Framework; | ||
using ParrotSharp; | ||
using ParrotSharp.Pmc; | ||
using System; | ||
|
||
namespace ParrotSharpTest | ||
{ | ||
[TestFixture()] | ||
public class PMC_Test { | ||
|
||
[Test()] | ||
public void BoxString() { | ||
string exename = AppDomain.CurrentDomain.FriendlyName; | ||
Parrot parrot = new Parrot(Parrot_Test.ParentInterpreter, exename); | ||
|
||
Parrot_PMC box = "This is a parrot string".ToParrotStringPMC(parrot); | ||
Assert.AreEqual("This is a parrot string", box.ToString(), "Can't box string into a PMC"); | ||
} | ||
|
||
[Test()] | ||
public void InvokeMethod() { | ||
string exename = AppDomain.CurrentDomain.FriendlyName; | ||
Parrot parrot = new Parrot(Parrot_Test.ParentInterpreter, exename); | ||
|
||
Parrot_PMC pmc_string = "This is a parrot string".ToParrotStringPMC(parrot); | ||
IPMCFactory<CallContext> sign_factory = CallContext.GetFactory(parrot); | ||
CallContext sign = sign_factory.Instance(); | ||
sign.Signature = "PiSS->".ToParrotString(parrot); | ||
sign.AddArgument(pmc_string); | ||
sign.AddArgument("string".ToParrotStringPMC(parrot)); | ||
sign.AddArgument("pmc".ToParrotStringPMC(parrot)); | ||
|
||
pmc_string.InvokeMethod("replace".ToParrotString(parrot), sign); | ||
Assert.AreEqual("This is a parrot pmc", pmc_string.ToString(), "Error when invoking a method"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using NUnit.Framework; | ||
using ParrotSharp; | ||
using ParrotSharp.Pmc; | ||
using System; | ||
|
||
namespace ParrotSharpTest | ||
{ | ||
[TestFixture()] | ||
public class Parrot_Test { | ||
|
||
static private Parrot ParrotParent = null; | ||
|
||
static public Parrot ParentInterpreter { | ||
get { | ||
if(ParrotParent != null) return ParrotParent; | ||
else { | ||
ParrotParent = new Parrot(); | ||
return ParrotParent; | ||
} | ||
} | ||
} | ||
|
||
[Test()] | ||
public void CreateParrot() { | ||
string exename = AppDomain.CurrentDomain.FriendlyName; | ||
Parrot parrot = new Parrot(ParentInterpreter, exename); | ||
Assert.AreNotEqual(IntPtr.Zero, parrot.RawPointer, "Unable to create a new Parrot interpreter"); | ||
} | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.