๐Ÿ“ฆ amake / GrandPerspective

๐Ÿ“„ ItemStringTest.m ยท 51 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51#import "ItemStringTest.h"

#import "StringTest.h"


@implementation ItemStringTest

// Overrides designated initialiser
- (instancetype) init {
  NSAssert(NO, @"Use initWithStringTest: instead.");
  return [self initWithStringTest: nil];
}

- (instancetype) initWithStringTest:(StringTest *)stringTestVal {
  if (self = [super init]) {
    _stringTest = [stringTestVal retain];
  }
  return self;
}

- (instancetype) initWithPropertiesFromDictionary:(NSDictionary *)dict {
  if (self = [super initWithPropertiesFromDictionary: dict]) {
    NSDictionary  *stringTestDict = dict[@"stringTest"];
    
    _stringTest = [[StringTest stringTestFromDictionary: stringTestDict] retain];
  }
  
  return self;
}

- (void) dealloc {
  [_stringTest release];

  [super dealloc];
}


- (void) addPropertiesToDictionary:(NSMutableDictionary *)dict {
  [super addPropertiesToDictionary: dict];
  
  dict[@"stringTest"] = [self.stringTest dictionaryForObject];
}


- (TestResult) testFileItem:(FileItem *)item {
  NSAssert(NO, @"This method must be overridden.");
  return TEST_FAILED;
}

@end