glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] USL return Patch & Unit Testing Framework


From: Numbeast .
Subject: Re: [glob2-devel] USL return Patch & Unit Testing Framework
Date: Thu, 6 Aug 2009 18:15:20 -0700

Quinn,

Thank you for your welcome, I'm glad to have found such a cool open source game.

Leo,

Thank you for your encouragement and advice, as you can see forking worked fine and I was able to use my knowledge of git to figure out how to use mercurial. I'm glad people have been looking

Martin,

I've been wondering who wrote usl, so I could tell you how amazing I think it is. While it's obviously still in development I'm impressed at how much work has been put into it. I've glanced at inprepreter.cpp and I'm fairly sure that the return value will not be garbage collected but I'll test that, thanks for the heads up.

I've also just pushed a few more changes into my public repo. The existing test has been changed to use Boost::Test and there's now a build target which compiles and runs all unit tests, "scons test=1". I still need to write something which checks that boost_unit_test_framework(-mt) is installed but it's not required unless you specify test=1.

By the way I'm a beginner at scons, if anyone could look at my changes and tell me if I did anything wrong/offer suggestions on how to do it better please speak up. Specifically I would like to include any object files which are required by the unit tests, as opposed to manually adding every one to SConscript.

On Thu, Aug 6, 2009 at 11:35 AM, Martin Voelkle <address@hidden> wrote:
Hello Brian,

On Wed, Aug 5, 2009 at 8:16 AM, Numbeast .<address@hidden> wrote:
> After a very brief conversation with giszmo3 I decided I would try tackling
> adding unit testing to Glob2. I started with libusl but quickly ran into a
> problem, USL provides no method of receiving the return value of a script.
> The value is dumped to cout but not saved for later. In order to test for
> the proper execution of scripts, it would be nice to know that a script
> returns (what the result of executing the last line is). I therefore made
> this small (2 additional lines) patch for intrepreter.cpp and intrepreter.h
> so that after USL step()s through a thread until it's state is state:STOP it
> saves the return value. After asking on irc i was told that this would be a
> good place to ask for this small diff to be committed (the diff is
> attached).

It's great to see you playing with usl!
Your patch seems right, except that you have to make sure that the
return value is not garbage collected: in Thread::markForGC(), call
returnValue->markForGC() if returnValue != 0.
I invented the language and implemented it with Steph, feel free to
ask questions here, as we don't hang much on IRC.

> On another subject, after a little thought I decided to use Boost:Test as
> the testing framework. Your wiki says you don't want any extra dependencies
> but in your mailing lists there have been a few comments to the effect of if
> something makes programming simpler you'll accept it, and I believe using
> Boost:Test is much easier and faster than implementing your own library. You
> probably allready have it installed considering you use Boost:Thread. Any
> feedback on this choice would be greatly appreciated.

Since it's for unit testing, you can make it optional. The tests would
be compiled and run at build-time only if boost:test is available.

Martin


_______________________________________________
glob2-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/glob2-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]