mirror of
https://github.com/zxing/zxing.git
synced 2024-11-13 22:44:09 -08:00
711e746900
git-svn-id: https://zxing.googlecode.com/svn/trunk@1869 59b500cc-1b3d-0410-9834-0bbf25fbcc57
51 lines
1.6 KiB
Objective-C
51 lines
1.6 KiB
Objective-C
//
|
|
// BookmarkDoCoMoTests.m
|
|
// ZXingWidget
|
|
//
|
|
// Created by George Nachman on 7/27/11.
|
|
// Copyright 2011 ZXing Authors. All rights reserved.
|
|
//
|
|
|
|
#import <SenTestingKit/SenTestingKit.h>
|
|
#import <UIKit/UIKit.h>
|
|
#import "BookmarkDoCoMoResultParser.h"
|
|
#import "URIParsedResult.h"
|
|
|
|
@interface BookmarkDoCoMoTests : SenTestCase
|
|
@end
|
|
|
|
@implementation BookmarkDoCoMoTests
|
|
|
|
- (void)testWellFormedBookmarkDoCoMo {
|
|
NSString *msg =
|
|
@"MEBKM:;"
|
|
@"URL:http://www.example.com/;"
|
|
@"TITLE:The Title;";
|
|
URIParsedResult *result = (URIParsedResult *)
|
|
[BookmarkDoCoMoResultParser parsedResultForString:msg
|
|
format:BarcodeFormat_QR_CODE];
|
|
STAssertTrue([result.urlString isEqualToString:@"http://www.example.com/"],
|
|
@"Wrong URL string %@", result.urlString);
|
|
STAssertTrue([[result.URL host] isEqualToString:@"www.example.com"],
|
|
@"Wrong URL host %@", [result.URL host]);
|
|
STAssertTrue([[result.URL path] isEqualToString:@"/"],
|
|
@"Wrong URL path %@", [result.URL path]);
|
|
STAssertTrue([[result.URL scheme] isEqualToString:@"http"],
|
|
@"Wrong URL scheme %@", [result.URL scheme]);
|
|
STAssertTrue([result.title isEqualToString:@"The Title"],
|
|
@"Wrong title %@", result.title);
|
|
}
|
|
|
|
- (void)testMalformedBookmarkDoCoMo {
|
|
NSString *msg =
|
|
@"URL:http://www.example.com/;"
|
|
@"TITLE:The Title";
|
|
URIParsedResult *result = (URIParsedResult *)
|
|
[BookmarkDoCoMoResultParser parsedResultForString:msg
|
|
format:BarcodeFormat_QR_CODE];
|
|
STAssertNil(result, @"Bogus string matched.");
|
|
}
|
|
|
|
|
|
@end
|