Permalink
Browse files

La till några teststubbar

  • Loading branch information...
henriq committed Feb 20, 2011
1 parent e2b9a6b commit c356f1f1b5e7a6d707beb0e4a49e324c5a3330c3
Showing with 113 additions and 2 deletions.
  1. +45 −0 Classes/ArticleTest.m
  2. +15 −2 Classes/ExampleTestCase.m
  3. +45 −0 Classes/ListTest.m
  4. +8 −0 Handla.xcodeproj/project.pbxproj
View
@@ -0,0 +1,45 @@
+//
+// ArticleTest.m
+// Handla
+//
+// Created by Fredrik on 2/19/11.
+// Copyright 2011 Kungliga Tekniska Högskolan. All rights reserved.
+//
+
+#import "TestingConstants.m"
+
+/**
+ *
+ * Unit tests for Articles.
+ *
+ */
+
+@interface ArticleTest : GHTestCase {
+}
+- (void)testInsertion; /** Tests insertion of objects into a list */
+- (void)testRemoval; /** Tests removal of objects from a list */
+- (void)setUp; /** Ran before each test */
+- (void)tearDown; /** Ran after each test */
+@end
+
+
+
+@implementation ArticleTest
+
+-(void)setUp
+{
+}
+
+-(void)tearDown
+{
+}
+
+- (void)testInsertion {
+ Assert(YES, @"Description of failure");
+}
+
+- (void)testRemoval {
+ Assert(YES, @"Description of failure");
+}
+
+@end
View
@@ -8,12 +8,22 @@
#import "TestingConstants.m"
+/**
+ *
+ * This class is an example class of how to write unittests. Write (at least) one GHTestCase for each class under testing.
+ *
+ * All methods that start with test are automatically run during the testing phase.
+ *
+ * @see http://gabriel.github.com/gh-unit/interface_g_h_test_case.html
+ *
+ */
@interface ExampleTestCase : GHTestCase {
int number;
}
-- (void)testMath;
-- (void)setUp;
+- (void)testMath; /** Runs a math test */
+- (void)setUp; /** Ran before each test */
+- (void)tearDown; /** Ran after each test */
@end
@@ -27,5 +37,8 @@ -(void)setUp
- (void)testMath {
GHAssertTrue((number*2) == 200, @"100*2 != 200? right...");
}
+- (void)tearDown
+{
+}
@end
View
@@ -0,0 +1,45 @@
+//
+// testList.m
+// Handla
+//
+// Created by Fredrik Henriques on 2/19/11.
+// Copyright 2011 Kungliga Tekniska Högskolan. All rights reserved.
+//
+
+#import "TestingConstants.m"
+
+/**
+ *
+ * Unit tests for List.
+ *
+ */
+
+@interface ListTest : GHTestCase {
+}
+- (void)testInsertion; /** Tests insertion of objects into a list */
+- (void)testRemoval; /** Tests removal of objects from a list */
+- (void)setUp; /** Ran before each test */
+- (void)tearDown; /** Ran after each test */
+@end
+
+
+
+@implementation ListTest
+
+-(void)setUp
+{
+}
+
+-(void)tearDown
+{
+}
+
+- (void)testInsertion {
+ Assert(YES, @"Description of failure");
+}
+
+- (void)testRemoval {
+ Assert(YES, @"Description of failure");
+}
+
+@end
@@ -21,6 +21,8 @@
352EA63F130AC045001D6E7F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
352EA640130AC045001D6E7F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
352EA641130AC045001D6E7F /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28D801B30F44B63D00FB423F /* CoreData.framework */; };
+ 35D878E3131014BA00A8A5BF /* ListTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 35D878D41310134400A8A5BF /* ListTest.m */; };
+ 35D879101310158E00A8A5BF /* ArticleTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 35D879021310150200A8A5BF /* ArticleTest.m */; };
481BFF76130D16E700AC4CC8 /* AddArticleListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 481BFF75130D16E700AC4CC8 /* AddArticleListViewController.m */; };
481BFF8A130D18DC00AC4CC8 /* BudgetSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 481BFF88130D18DC00AC4CC8 /* BudgetSettingsViewController.m */; };
481BFF98130D1E9B00AC4CC8 /* AddBudgetPostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 481BFF97130D1E9B00AC4CC8 /* AddBudgetPostViewController.m */; };
@@ -68,6 +70,8 @@
352EA5F1130ABF95001D6E7F /* Unit tests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Unit tests.app"; sourceTree = BUILT_PRODUCTS_DIR; };
352EA5F3130ABF95001D6E7F /* Unit tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Unit tests-Info.plist"; sourceTree = "<group>"; };
352EA5F7130ABFB9001D6E7F /* GHUnitIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GHUnitIOS.framework; path = Unit_testing/GHUnitIOS.framework; sourceTree = "<group>"; };
+ 35D878D41310134400A8A5BF /* ListTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ListTest.m; sourceTree = "<group>"; };
+ 35D879021310150200A8A5BF /* ArticleTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArticleTest.m; sourceTree = "<group>"; };
481BFF74130D16E700AC4CC8 /* AddArticleListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddArticleListViewController.h; sourceTree = "<group>"; };
481BFF75130D16E700AC4CC8 /* AddArticleListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddArticleListViewController.m; sourceTree = "<group>"; };
481BFF87130D18DC00AC4CC8 /* BudgetSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BudgetSettingsViewController.h; sourceTree = "<group>"; };
@@ -203,6 +207,8 @@
352EA5E7130ABEF3001D6E7F /* GHUnitIOSTestMain.m */,
352EA5E6130ABEF3001D6E7F /* TestingConstants.m */,
352EA5E8130ABEF3001D6E7F /* ExampleTestCase.m */,
+ 35D878D41310134400A8A5BF /* ListTest.m */,
+ 35D879021310150200A8A5BF /* ArticleTest.m */,
);
name = "Unit tests";
sourceTree = "<group>";
@@ -403,6 +409,8 @@
352EA613130ABFD1001D6E7F /* GHUnitIOSTestMain.m in Sources */,
352EA614130ABFD1001D6E7F /* TestingConstants.m in Sources */,
352EA615130ABFD1001D6E7F /* ExampleTestCase.m in Sources */,
+ 35D878E3131014BA00A8A5BF /* ListTest.m in Sources */,
+ 35D879101310158E00A8A5BF /* ArticleTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit c356f1f

Please sign in to comment.