'전체 글'에 해당되는 글 274건

  1. 2006.11.17 나만 시작한다면....
  2. 2006.11.11 CppUnitLite2 v1.1
  3. 2006.11.04 Latest Win32 binary builds of Emacs CVS 설치
  4. 2006.10.31 Cool Keys in Emacs

나만 시작한다면....

etc 2006. 11. 17. 01:06 posted by CecilDeSK
반응형

내가 태어날때 부모님은 날 보며
수많은 생각과 기댈 하셨겠지

어릴때나 지금도 변함없는 건
자랑스런 나를 보여주는 일

시간은 언제나 나를 반기고
저 파란 하늘은 이렇게 날 지켜보고

나만 시작한다면 달라질 세상
나 진정 원하는 그일

슬프면 슬픈대로 나를 떠 맡겨도
부서지진 않을 수 있는
커다란 인생에 무대위에서 지금부터 시작이야


시간은 언제나 나를 반기고
저 파란 하늘은 이렇게 날 지켜보고

나만 시작한다면 달라질 세상
나 진정 원하는 그일

그 누가 무슨 말을 내 삶에 던져도
흔들리지 않을 수 있는

내 삶의 주인은 나임을 알고
늦지 않았음을 알고

슬프면 슬픈대로 나를 떠 맡겨도
부셔지진 않을 수 있는
커다란 인생의 무대위에서 지금 부터 시작이야

힘겨운 날이 있어 더욱 기쁜 날들
그누구도 모르는 내일
커다란 인생의 무대 위에서 지금부터
시작이야...

반응형

CppUnitLite2 v1.1

Development 2006. 11. 11. 05:23 posted by CecilDeSK
반응형
http://www.gamesfromwithin.com/articles/0512/000103.html

CppUnitLite2_1_1.tar.gz

About a year ago, I wrote an article comparing unit test frameworks
that went to become one of the most popular in this site. The article
concluded with the recommendation of one of the less well known
frameworks: CxxTest.

Shortly after writing that article, it came time to roll out
test-driven development at work. Interestingly, once I weighted in
all the requirements, I ended up not following my own advice.
Instead, I decided to go with a customized version of CppUnitLite,
which was listed in the article as the second choice. The idea of
an extremely simple unit testing framework was too attractive to
pass up in an environment where we have to support a large variety
of environments and target platforms.


At this point, we have been using CppUnitLite2 for a year at
High Moon Studios to do TDD on Windows, Xbox 360, and
some PS3 (we even have a stripped-down version that runs on
a PS3 SPU). It has been used to unit test libraries of an
engine, pipeline tools, GUI applications, and production game code.


CppUnitLite2 was originally released along with my article a
year ago. It was a heavily modified version of the original
CppUnitLite by Michael Feathers. This version introduces the
changes we made at work as different issues came up and we needed
more functionality from the framework. In particular, Jim Tilander
and Charles Nicholson were responsible for a lot of those changes.
By now, I doubt there's a single line left from the original code. Additionally,
CppUnitLite2 itself has a set of tests using itself in an interestingly
recursive way.


What's new


Fixtures created and destroyed around each test.


I can't believe that the original
version of CppUnitLite2 didn't have this feature. It was the
biggest glaring problem with the framework (I even pointed it out
in the article). Each fixture used to be created at static
initialization time, which, apart from being a really bad idea,
caused a lot of objects to be created and live in memory at the
same time. Considering that some of those objects would
initialize/shutdown some important game systems, we clearly needed
to manage their lifetime a bit better.


The test macro was changed to
register a temporary test with the TestRegistry, which in turn will
create the fixture at execution time. Now fixtures and tests are
created just before each test, and destroyed right after, just as
you would expect from any sane framework.


For those masochists out there, here's the ugly macro for a test
with fixture in all its glory. Notice how the TestRegistrar
registers the dummy test class that we created as part of the
macro.



#define TEST_F(fixture, test_name)
struct fixture##test_name : public fixture {
fixture##test_name(const char * name_) : m_name(name_) {}
void test_name(TestResult& result_);
const char * m_name;
};
class fixture##test_name##Test : public Test
{
public:
fixture##test_name##Test ()
: Test (#test_name "Test", __FILE__, __LINE__) {}
protected:
virtual void RunTest (TestResult& result_);
} fixture##test_name##Instance;
TestRegistrar fixture##test_name##_registrar (&fixture##test_name##Instance);
void fixture##test_name##Test::RunTest (TestResult& result_) {
fixture##test_name mt(m_name);
mt.test_name(result_);
}
void fixture ## test_name::test_name(TestResult& result_)



Improved check statements


Another one of the major weaknesses of CppUnitLite as it stood
was the check statements. You needed to have a custom check macro
for each data type you cared to check. The generic CHECK_EQUAL
macro will now work on any data type as long as it can be compared
with operator == and output to a stream.


This version of CppUnitLite2 also includes some special macros
to check arrays with one and two dimensions. Again, this works on
any data type that supports operator == and operator[]. It came it
very handy for checking equality of vectors and matrices in a game
engine. For example, the following code checks that two matrices
are equal:



CHECK_ARRAY2D_CLOSE (m1, m2, 4, 3, kEpsilon);

Ironically, in some heavily restricted environments (like the
PS3 cell processors), we can't use streams, so in that case we're
forced to go back to the old specialized check macros.


Invariant statements in checks


Another really annoying feature of the previous version of
CppUnitLite2 was that the code in a check statement was called
multiple times, which could cause strange side effects.


Consider the following code:



CHECK_EQUAL (FunctionWithSideEffects1(), FunctionWithSideEffects1());

The way the check statement was expanded out, both those
functions could be evaluated multiple times. If the functions had
side effects, they would be executed several times, causing
unexpected results (for example, the check could fail but the
printed result could be different). The fix wasn't trivial because
we couldn't save off the value of each statement because they could
be of any type and we have no way of finding the type from within
the macro.


The check macro now expands out to a templated function, which
is able to evaluate both statements only once and work with the
saved value to avoid any surprising side effects.


Optional fixture initialization


As we continued hammering on the unit test framework for all our
development, one clear pattern appeared that wasn't handled by the
framework: Being able to create fixtures with parameters defined in
the test. For example, the fixture might do ten different steps,
but we want to set a particular value in one of those steps, and by
the time control reaches the test code itself it's too late.


We started getting around that by creating different fixtures,
and then by inhereting from other fixtures and changing some
parameters. Both of those solutions were less than ideal (lots of
code duplication and added complexity). Things got out of hand when
we made the fixtures a templated class on a value, and created them
by specifying the value as part of the texture name. Now it was a
pain to debug and things were even less clear.


So we finally implemented it natively in CppUnitLite2 as
fixtures with initialization parameters. We introduced a new macro,
TEST_FP (test with fixture and parameters), which takes any
parameters you want to pass to the fixture constuctor.


Now you can declare tests like this:



TEST_FP (VectorFixture, VectorFixture(10), MyTest)

{

}


We should probably simplify that to avoid repeating the fixture
name, but that works fine for now.


Include cleanup


The original version of CppUnitLite was pretty casual about what
headers it included. Unfortunately, that means that all test code
were automatically exposed to a variety of standard headers,
whether you wanted it or not. This version is a lot more strict,
and the only header that will get pulled in from using it will be
iosfwd, which is even a fairly lightweight one.


Memory allocations


We have very strict memory allocation wrappers around our tests,
and if any memory leaks, it is reported as a failed test. Since
checking for memory allocations is very platform specific, it is
left out of the framework (although it could be added pretty easily
in the platform-specific sections). In any case, some of the
static-initialization time allocations were confusing the memory
tracker, so we removed them completely. All it means is that we use
an array to register tests instead of a std::vector and we cap the
maximum number of tests to a fixed amount. If you need more than
the default 5000 tests, go right ahead and add a few zeros.


New license


Previous versions of CppUnitLite were not released with an
explicit license. To make things clear, I explicitly added the
license text for the MIT license with an added restriction.
The MIT license allows you to use the code in any project,
commercial or otherwise, without any restrictions.
The added restriction to the license prohibits its use in any
military applications or projects with any military funding.


Ratings


How does this release of the CppUnitLite2 compare with respect
to my initial set of features I used to rate the different unit
tests frameworks?



  • Minimal amount of work needed to add new tests. Nothing
    has changed there. Still passes with flying colors.

  • Easy to modify and port. That has always been the strong
    suite of this framework.

  • Supports setup/teardown steps (fixtures). Much improved
    now by creating them correctly around each test.

  • Handles exceptions and crashes well. No changes there.
    Still one of the best I've seen.

  • Good assert functionality. The check macros have been
    much improved to match the best frameworks out there.

  • Supports different outputs. Yup. Still there.

  • Supports suites. It still doesn't. It just shows that I
    really haven't needed this feature yet.


Future work


So, what's next for CppUnitLite2? It's really quite usable right
now, but I could see a few changes happening in the next year, and
maybe a few others will come up and surprise me.


Test registration is based on static initialization of global
variables, which is not very reliable across compliers. For
example, if you try to put the tests in a static library, MSVC will
strip out the registration code leaving you with no tests. To get
around that, we could introduce a custom build step in a scripting
language that would generate a simple file with explicit
registration of tests. This could also be used to collect tests
from many different libraries into a single executable.


A couple of times it would have been convenient to have
parameterized tests (I think that's the correct term for it).
Basically, to have tests that could run with different data.
Something like this:



TEST_PARAM(MyCustomTest, int a, int b)
{
CHECK (something);
CHECK(something else);
CHECK(yadda yadda);
}

TEST(MyTest)
{
CALL_TEST(MyCustomTest, 10, 5);
}
TEST(MyTest)
{
CALL_TEST(MyCustomTest, 12, 7);
}

The key point is that a test fails in the parameterized test, it
should report the error correctly indicating where it came
from.


This is actually pretty easy to implement with a couple of
macros. We simply haven't needed it more than a couple of times, so
we haven't bothered yet. But I imagine next time we run up against
this we'll bite the bullet and implement it.


Wrap-up


Charles had so much fun working with this framework, he decided
to write his own from scratch. He made it available on his web
site, so go check it out.


Thanks to High Moon Studios for being open and letting us
release the changes we made and share them back with everybody. If
you end up using the framework and you make any changes, drop me an
email and I'll add them for the next release.

반응형

Latest Win32 binary builds of Emacs CVS 설치

Emacs 2006. 11. 4. 04:04 posted by CecilDeSK
반응형
emacs 윈도우즈용 바이너리는 컴파일이 이미 되어진 상태로 CVS에서 업데이트를 통해

일정 기간마다배포 되어집니다.

윈도우즈용 바이너리경우 몇몇 곳에서 배포하지만 그중에 가장 최근자료를 올려놓는

http://sourceforge.net/projects/ntemacs/ 에서

자료를 받아 설치하는 간단한 방법을 설명합니다.


사실 그냥 받아서 압축만 풀어놓아도 큰문제는 안생기지만 몇가지 추가적 사항 있습니다.

우선 저곳에서 22 버전이나 23버전을 다운받습니다.(되도록 22버전을 추천합니다)

우선 받아서 실행하게 되면 7zip으로 된 자동압축 버전이 풀립니다.

c: 같은 곳에 풀어놓으면 C:\ntemacs22 에 설치됩니다.

일단 C:\ntemacs22에 풀어놓았다고 생각하고 ..

addpm.exe 를 한번 실행해주면 프로그램 메뉴에 등록과 함께 Registry에 emacs

환경 설정을 등록하지만 원래 레지에 해당 루트가없을 경우 생성되지 않더군요 ..
(구버전에 있는것은 되었지만 현재 배포된 것 안에있는것들은 안되더군요)

addpm을 실행하기 전에 regedit 를 실행해서

HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs 란 패스까지 만드시기 바랍니다.

다른건 이미 있으므로 GNU 와 하위에 Emacs 두가지만 추가하시면 나머진 addpm.exe실행하면 만들어 집니다.

레지스트리 만들기가 어려운 분은 레지 화일을 추가합니다.

emacs_winnt_reg.reg


한번만 실행후에 addpm.exe 실행 그리고 다음 작업으로

Emacs HOME_DIR 설정이 필요한데

시작_설정_제어판

내컴퓨터 -> 속성 -> 고급 -> 환경변수 -> 사용자 변수 부분이나 시스템 변수 부분에

새로 만들기 하나 하시고 변수이름에 HOME 변수값에 c:\ntemacs22 으로 추가만 해주시면 끝납니다.




반응형

'Emacs' 카테고리의 다른 글

emacs "find file" default path setup  (0) 2015.11.18
Emacs 22.3 released  (2) 2008.09.09
GNU Emacs 22.2.1 한글관련 설정 Windows XP  (4) 2008.06.01
emacs 에서 사용가능한 폰트이름 알아내기  (2) 2006.11.19
Cool Keys in Emacs  (0) 2006.10.31

Cool Keys in Emacs

Emacs 2006. 10. 31. 14:00 posted by CecilDeSK
반응형

Note that C-x means Control-X while M-x means Meta-X where meta may mean hitting and releasing the escape key, or alt. These keys are excerpted from the Unix in a Nutshell book. The first column has their default key binding; the second their function name; last is a short description.
반응형