On Tue, Apr 19, 2011 at 2:42 PM, Ryosuke Niwa <[email protected]> wrote:
> Can we see examples of tests that use TestWebKitAPI / gtest? I think it'll
> be helpful for people who don't know how the said two testing frameworks
> work.
>
> Ideally, we compare the same test written in TestWebKitAPI and gtest to
> decide which framework is better.
>
Here's a test using TestWebKitAPI
#include "Test.h"
#include <JavaScriptCore/Vector.h>
TEST(WTF, VectorBasic)
{
Vector<int> intVector;
TEST_ASSERT(intVector.isEmpty());
TEST_ASSERT(intVector.size() == 0);
TEST_ASSERT(intVector.capacity() == 0);
}
Here's the same test written using gtest:
#include "gtest.h"
#include <JavaScriptCore/Vector.h>
TEST(WTF, VectorBasic)
{
Vector<int> intVector;
ASSERT_TRUE(intVector.isEmpty());
ASSERT_EQ(0, intVector.size());
ASSERT_EQ(0, intVector.capacity());
}
With respect to writing a simple test, they both make it easy to write one,
so I don't think this is the deciding factor.
Dave
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev