@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -28,11 +28,11 @@ # import "OFSelectKernelEventObserver.h" #endif #import "TestsAppDelegate.h" -#define EXPECTED_EVENTS 3 +static const size_t numExpectedEvents = 3; static OFString *module; @interface ObserverTest: OFObject { @@ -88,11 +88,11 @@ [_testsAppDelegate outputTesting: @"-[observe] with listening socket" inModule: module]; deadline = [OFDate dateWithTimeIntervalSinceNow: 1]; - while (_events < EXPECTED_EVENTS) { + while (_events < numExpectedEvents) { if (deadline.timeIntervalSinceNow < 0) { deadlineExceeded = true; break; } @@ -108,11 +108,11 @@ outputFailure: @"-[observe] not exceeding deadline" inModule: module]; _fails++; } - if (_events == EXPECTED_EVENTS) + if (_events == numExpectedEvents) [_testsAppDelegate outputSuccess: @"-[observe] handling all events" inModule: module]; else { [_testsAppDelegate @@ -122,11 +122,11 @@ } } - (void)objectIsReadyForReading: (id)object { - char buf; + char buffer; switch (_events++) { case 0: if (object == _server) [_testsAppDelegate @@ -147,11 +147,12 @@ inModule: module]; break; case 1: if (object == _accepted && - [object readIntoBuffer: &buf length: 1] == 1 && buf == '0') + [object readIntoBuffer: &buffer length: 1] == 1 && + buffer == '0') [_testsAppDelegate outputSuccess: @"-[observe] with data ready to read" inModule: module]; else { [_testsAppDelegate @@ -167,11 +168,11 @@ inModule: module]; break; case 2: if (object == _accepted && - [object readIntoBuffer: &buf length: 1] == 0) + [object readIntoBuffer: &buffer length: 1] == 0) [_testsAppDelegate outputSuccess: @"-[observe] with closed connection" inModule: module]; else { [_testsAppDelegate