<commit_before>@import <Foundation/CPArray.j>
@import <Foundation/CPData.j>
@import <Foundation/CPDictionary.j>
@import <Foundation/CPKeyedArchiver.j>
@import <Foundation/CPLog.j>
@import <Foundation/CPNumber.j>

@implementation CPDataTest : OJTestCase
{
}

-(void)setUp
{
    string_data = [[CPData alloc] initWithString:@"CPData Test"];
    
    // Plist helpers
    keys = [CPArray arrayWithObjects:@"key1", @"key2", @"key3", @"key4", nil];
    objects = [CPArray arrayWithObjects:@"Some random characters", [CPNumber numberWithBool:NO], [CPNumber numberWithDouble:9.9], [CPNumber numberWithDouble:8.8], nil];
    dict = [CPDictionary dictionaryWithObjects:objects forKeys:keys];

    plist_data = [[CPData alloc] initWithPlistObject:dict];
}

-(void)testStringLength
{
    var data = [[CPData alloc] initWithString:@"CPData Test"];
    [self assert:[data length] equals:[CPNumber numberWithInt:11]];
    
    var data_cm = [CPData dataWithString:@"CPData Test"];
    [self assert:[data_cm length] equals:[CPNumber numberWithInt:11]];
}

-(void)testPlistLength
{
    var data = [[CPData alloc] initWithPlistObject:dict];
    [self assert:[data length] equals:[CPNumber numberWithInt:93]];

    var data_cm = [CPData dataWithPlistObject:dict];
    [self assert:[data length] equals:[CPNumber numberWithInt:93]];
}

-(void)testDescription
{
    [self assert:[string_data description] equals:[string_data string]];
}

-(void)testString
{
    [self assert:[string_data string] equals:@"CPData Test"];
}

-(void)testStringFromPlist
{
    [self assert:[plist_data string] equals:"280NPLIST;1.0;D;K;4;key4f;3;8.8K;4;key3f;3;9.9K;4;key2F;K;4;key1S;22;Some random charactersE;"];
}

-(void)testPlistObject
{
    [self assert:[[plist_data plistObject] objectForKey:@"key1"] equals:@"Some random characters"];
    [self assert:[[plist_data plistObject] objectForKey:@"key2"] equals:[CPNumber numberWithBool:NO]];
    [self assert:[[plist_data plistObject] objectForKey:@"key3"] equals:[CPNumber numberWithDouble:9.9]];
    [self assert:[[plist_data plistObject] objectForKey:@"key4"] equals:[CPNumber numberWithDouble:8.8]];
    
    [self assert:[plist_data plistObject] equals:dict];
}

-(void)testSetPlistObject
{
    var data = [[CPData alloc] init];
    [data setPlistObject:dict];
    
    [self assert:[data plistObject] equals:dict];
}

-(void)testSetString
{
    var data = [[CPData alloc] init];
    [data setString:@"CPData Test"];
    
    [self assert:[data string] equals:@"CPData Test"];
}
@end<commit_msg>remove unused import<commit_after>@import <Foundation/CPArray.j>
@import <Foundation/CPData.j>
@import <Foundation/CPDictionary.j>
@import <Foundation/CPKeyedArchiver.j>
@import <Foundation/CPNumber.j>

@implementation CPDataTest : OJTestCase
{
}

-(void)setUp
{
    string_data = [[CPData alloc] initWithString:@"CPData Test"];
    
    // Plist helpers
    keys = [CPArray arrayWithObjects:@"key1", @"key2", @"key3", @"key4", nil];
    objects = [CPArray arrayWithObjects:@"Some random characters", [CPNumber numberWithBool:NO], [CPNumber numberWithDouble:9.9], [CPNumber numberWithDouble:8.8], nil];
    dict = [CPDictionary dictionaryWithObjects:objects forKeys:keys];

    plist_data = [[CPData alloc] initWithPlistObject:dict];
}

-(void)testStringLength
{
    var data = [[CPData alloc] initWithString:@"CPData Test"];
    [self assert:[data length] equals:[CPNumber numberWithInt:11]];
    
    var data_cm = [CPData dataWithString:@"CPData Test"];
    [self assert:[data_cm length] equals:[CPNumber numberWithInt:11]];
}

-(void)testPlistLength
{
    var data = [[CPData alloc] initWithPlistObject:dict];
    [self assert:[data length] equals:[CPNumber numberWithInt:93]];

    var data_cm = [CPData dataWithPlistObject:dict];
    [self assert:[data length] equals:[CPNumber numberWithInt:93]];
}

-(void)testDescription
{
    [self assert:[string_data description] equals:[string_data string]];
}

-(void)testString
{
    [self assert:[string_data string] equals:@"CPData Test"];
}

-(void)testStringFromPlist
{
    [self assert:[plist_data string] equals:"280NPLIST;1.0;D;K;4;key4f;3;8.8K;4;key3f;3;9.9K;4;key2F;K;4;key1S;22;Some random charactersE;"];
}

-(void)testPlistObject
{
    [self assert:[[plist_data plistObject] objectForKey:@"key1"] equals:@"Some random characters"];
    [self assert:[[plist_data plistObject] objectForKey:@"key2"] equals:[CPNumber numberWithBool:NO]];
    [self assert:[[plist_data plistObject] objectForKey:@"key3"] equals:[CPNumber numberWithDouble:9.9]];
    [self assert:[[plist_data plistObject] objectForKey:@"key4"] equals:[CPNumber numberWithDouble:8.8]];
    
    [self assert:[plist_data plistObject] equals:dict];
}

-(void)testSetPlistObject
{
    var data = [[CPData alloc] init];
    [data setPlistObject:dict];
    
    [self assert:[data plistObject] equals:dict];
}

-(void)testSetString
{
    var data = [[CPData alloc] init];
    [data setString:@"CPData Test"];
    
    [self assert:[data string] equals:@"CPData Test"];
}
@end
{'fraction_non_alphanumeric': 0.1528776978417266, 'fraction_numerical': 0.017985611510791366, 'mean_word_length': 5.611624834874505, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3075786', 'n_tokens_mistral': 1792, 'n_tokens_neox': 1642, 'n_words': 335}