Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/VLC/modules/gui/macosx/tests/   (VLC Media Plyer ©)  Datei vom 23.9.2026 mit Größe 1 kB image not shown  

Quelle  VLCHexNumberFormatterTest.m  Sprache: unbekannt

 
Spracherkennung für: .m vermutete Sprache: Cobol {Cobol[36] Lisp[28] Masm[28]} [Methode: maximale Elemente, drei Dimensionen]

/****************************************************************************
 * VLCHexNumberFormatterTest.m: VLCHexNumberFormatter native tests
 ****************************************************************************
 * Copyright (C) 2026 VLC authors and VideoLAN
 *
 * Authors: Claudio Cambra <developer@claudiocambra.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *****************************************************************************/

#import <XCTest/XCTest.h>

#import "extensions/VLCHexNumberFormatter.h"

@interface VLCHexNumberFormatterTest : XCTestCase
@end

@implementation VLCHexNumberFormatterTest

- (void)testStringForObjectValue
{
    VLCHexNumberFormatter *formatter = [[VLCHexNumberFormatter alloc] init];

    XCTAssertEqualObjects([formatter stringForObjectValue:@0], @"000000");
    XCTAssertEqualObjects([formatter stringForObjectValue:@(0x12AB)], @"0012AB");
    XCTAssertNil([formatter stringForObjectValue:@"12AB"]);
    XCTAssertNil([formatter stringForObjectValue:nil]);
}

- (void)testGetObjectValue
{
    VLCHexNumberFormatter *formatter = [[VLCHexNumberFormatter alloc] init];
    id object = nil;

    XCTAssertTrue([formatter getObjectValue:&object
                                  forString:@"0012AB"
                           errorDescription:nil]);
    XCTAssertEqualObjects(object, @(0x12AB));

    object = nil;
    XCTAssertFalse([formatter getObjectValue:&object
                                   forString:@"not-hex"
                            errorDescription:nil]);
    XCTAssertNil(object);
}

@end

[Dauer der Verarbeitung: 0.2 Sekunden, vorverarbeitet 2026-10-24]