2
0

Added unit tests for playing around with the logic.

This commit is contained in:
Maarten Billemont
2012-07-04 23:57:29 +02:00
parent dea7434bd4
commit e967affddb
7 changed files with 307 additions and 0 deletions

22
Tests/Tests-Info.plist Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.lyndir.lhunath.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

10
Tests/Tests-Prefix.pch Normal file
View File

@@ -0,0 +1,10 @@
//
// Prefix header for all source files of the 'Tests' target in the 'Tests' project
//
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
#import "MasterPassword-Prefix.pch"

13
Tests/Tests.h Normal file
View File

@@ -0,0 +1,13 @@
//
// Tests.h
// Tests
//
// Created by Maarten Billemont on 04/07/12.
// Copyright (c) 2012 Lyndir. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@interface Tests : SenTestCase
@end

45
Tests/Tests.m Normal file
View File

@@ -0,0 +1,45 @@
//
// Tests.m
// Tests
//
// Created by Maarten Billemont on 04/07/12.
// Copyright (c) 2012 Lyndir. All rights reserved.
//
#import "Tests.h"
@implementation Tests
- (void)setUp
{
dbg(@"======================= TEST SET-UP ======================");
[PearlLogger get].autoprintLevel = PearlLogLevelTrace;
[super setUp];
// Set-up code here.
}
- (void)tearDown
{
dbg(@"===================== TEST TEAR-DOWN =====================");
// Tear-down code here.
[super tearDown];
}
- (void)testAlgorithm
{
NSString *masterPassword = @"test-mp";
NSString *username = @"test-user";
NSString *siteName = @"test-site";
MPElementType siteType = MPElementTypeGeneratedLong;
uint32_t siteCounter = 42;
NSString *sitePassword = MPCalculateContent( siteType, siteName, keyForPassword( masterPassword, username ), siteCounter );
inf( @"master password: %@, username: %@\nsite name: %@, site type: %@, site counter: %d\n => site password: %@",
masterPassword, username, siteName, NSStringFromMPElementType(siteType), siteCounter, sitePassword );
}
@end

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */