How to use in class

Best Atoum code snippet using in

AWSMobileClient.swift

Source:AWSMobileClient.swift Github

copy

Full Screen

1//2// Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.3//4// Licensed under the Apache License, Version 2.0 (the "License").5// You may not use this file except in compliance with the License.6// A copy of the License is located at7//8// http://aws.amazon.com/apache2.09//10// or in the "license" file accompanying this file. This file is distributed11// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either12// express or implied. See the License for the specific language governing13// permissions and limitations under the License.14//15// AWSMobileClientSwift.swift16// AWSMobileClient17//18import Foundation19/// Indicates the user state.20///21/// - signedIn: The user is signed in through Cognito User Pools or a federation provider like Google, Facebook, etc.22/// - signedOut: The user is signed out and does not have guest access.23/// - signedOutFederatedTokensInvalid: The tokens associated with the federation provider like Google or Facebook have expired and need to re-submitted to `AWSMobileClient`. You can do that by calling the `federatedSignIn` method or by showing the drop in UI. If the end user is unable to sign in, call `releaseSignInWait` method to return an error to the calling API.24/// - signedOutUserPoolsTokenInvalid: The Cognito User Pools tokens have expired and the end-user needs to sign in again. You can complete the sign in process using the `signIn` method or by showing the drop in UI. If the end user is unable to sign in, call `releaseSignInWait` method to return an error to the calling API.25/// - guest: The user is signed out, but has guest access in the app.26/// - unknown: The initial user state before `AWSMobileClient` is initialized.27public enum UserState: String {28 case signedIn, signedOut, signedOutFederatedTokensInvalid, signedOutUserPoolsTokenInvalid, guest, unknown29}30/// Callback type when registered to notifications for change in `UserState`. The dictionary contains information like `provider` which the user signed in with.31public typealias UserStateChangeCallback = (UserState, [String: String]) -> Void32/// Internal type to track what type of federation is active.33enum FederationProvider {34 case none, userPools, oidcFederation35}36/// The options object for drop-in UI which allows changing properties like logo image and background color.37@objc public class SignInUIOptions: NSObject {38 39 /// If true, the end user can cancel the sign-in operation and go back to previous view controller.40 @objc public let canCancel: Bool41 /// The logo image to be displayed on the sign-in screen.42 @objc public let logoImage: UIImage?43 /// The background color of the sign-in screen.44 @objc public let backgroundColor: UIColor?45 46 47 /// Initializer for the drop-in UI configuration.48 ///49 /// - Parameters:50 /// - canCancel: If set to true, the end user can cancel the sign-in operation and go back to previous view controller.51 /// - logoImage: The logo image to be displayed on the sign-in screen.52 /// - backgroundColor: The background color of the sign-in screen.53 @objc public init(canCancel: Bool = false,logoImage: UIImage? = nil, backgroundColor: UIColor? = nil) {54 self.canCancel = canCancel55 self.logoImage = logoImage56 self.backgroundColor = backgroundColor57 }58}59/// `AWSMobileClient` is used for all auth related operations when your app is accessing AWS backend.60public class AWSMobileClient: _AWSMobileClient {61 62 static var _sharedInstance: AWSMobileClient = AWSMobileClient(setDelegate: true)63 64 // MARK: Feature availability variables65 66 /// Determines if there is any Cognito Identity Pool available to federate against it.67 internal var isAuthorizationAvailable: Bool = false68 69 /// Should be set to true if using AWSAuthUI / AWSIdentityManager-AWSSignInManager70 internal var operateInLegacyMode: Bool = false71 72 // MARK: State handler variables73 74 var federationProvider: FederationProvider = .none75 var cachedLoginsMap: [String: String] = [:]76 /// Internal variable used to make sure AWSMobileClient is initialized only once.77 internal var isInitialized: Bool = false78 79 80 // MARK: Execution Helpers (DispatchQueue, OperationQueue, DispatchGroup)81 82 // Internal DispatchQueue which will be used synchronously to initialize the AWSMobileClient.83 internal let initializationQueue = DispatchQueue(label: "awsmobileclient.credentials.fetch")84 85 /// Operation Queue to make sure there is only 1 active API call which is fetching/ waiting for UserPools token.86 lazy var tokenFetchOperationQueue: OperationQueue = {87 var queue = OperationQueue()88 queue.name = "AWSMobileClient.tokenFetchOperationQueue"89 queue.maxConcurrentOperationCount = 190 return queue91 }()92 internal let tokenFetchLock = DispatchGroup()93 94 /// Operation Queue to make sure there is only 1 active API call which is fetching/ waiting for AWS Credentials.95 internal let credentialsFetchOperationQueue: OperationQueue = {96 var queue = OperationQueue()97 queue.name = "AWSMobileClient.credentialsFetchOperationQueue"98 queue.maxConcurrentOperationCount = 199 return queue100 }()101 internal let credentialsFetchLock = DispatchGroup()102 103 // MARK: AWSMobileClient helpers104 105 let ProviderKey: String = "provider"106 let TokenKey: String = "token"107 108 /// The internal Cognito Credentials Provider109 var internalCredentialsProvider: AWSCognitoCredentialsProvider?110 111 internal var pendingAWSCredentialsCompletion: ((AWSCredentials?, Error?) -> Void)? = nil112 113 var keychain: AWSUICKeyChainStore = AWSUICKeyChainStore.init(service: "\(String(describing: Bundle.main.bundleIdentifier)).AWSMobileClient")114 115 /// The registered listeners who want to observe change in `UserState`.116 var listeners: [(AnyObject, UserStateChangeCallback)] = []117 118 119 // MARK: Public API variables120 121 /// Returns the current state of user. If MobileClient is not initialized, it will return `unknown`122 public var currentUserState: UserState = .unknown123 124 125 /// Returns the username of the logged in user, nil otherwise.126 public var username: String? {127 return self.userpoolOpsHelper.currentActiveUser?.username128 }129 130 131 /// The identity id associated with this provider. This value will be fetched from the keychain at startup. If you do not want to reuse the existing identity id, you must call the clearKeychain method. If the identityId is not fetched yet, it will return nil. Use `getIdentityId()` method to force a server fetch when identityId is not available.132 override public var identityId: String? {133 return self.internalCredentialsProvider?.identityId134 }135 136 @objc override public func interceptApplication(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {137 return _AWSMobileClient.sharedInstance().interceptApplication(application, open: url, sourceApplication: sourceApplication, annotation: annotation)138 }139 140 /// Returns true if there is a user currently signed in.141 @objc public var isSignedIn: Bool {142 get {143 if (operateInLegacyMode) {144 return _AWSMobileClient.sharedInstance().isLoggedIn145 } else {146 return self.cachedLoginsMap.count > 0147 }148 }149 }150 151 152 /// The singleton instance of `AWSMobileClient`.153 ///154 /// - Returns: The singleton `AWSMobileClient` instance.155 @objc override public class func sharedInstance() -> AWSMobileClient {156 return _sharedInstance157 }158 159 160 /// Initializes `AWSMobileClient` and determines the `UserState` for current user using cache.161 ///162 /// - Parameter completionHandler: Callback which describes current user's state.163 public func initialize(_ completionHandler: @escaping (UserState?, Error?) -> Void) {164 // Read awsconfiguration.json and set the credentials provider here165 initializationQueue.sync {166 167 if (operateInLegacyMode) {168 completionHandler(nil, AWSMobileClientError.invalidState(message: "The AWSMobileClient is being used in the legacy mode. To use this initialize method please refer to the documentation."))169 return170 }171 172 if (isInitialized) {173 completionHandler(self.currentUserState, nil)174 return175 }176 177 self.loadLoginsMapFromKeychain()178 if self.cachedLoginsMap.count > 0 {179 if self.userPoolClient?.currentUser()?.isSignedIn == true {180 self.federationProvider = .userPools181 } else {182 self.federationProvider = .oidcFederation183 }184 }185 186 let infoObject = AWSInfo.default().defaultServiceInfo("IdentityManager")187 if let credentialsProvider = infoObject?.cognitoCredentialsProvider {188 189 self.isAuthorizationAvailable = true190 self.internalCredentialsProvider = credentialsProvider191 _AWSMobileClient.sharedInstance().update(self)192 self.internalCredentialsProvider?.setIdentityProviderManagerOnce(self)193 _AWSMobileClient.sharedInstance().registerConfigSignInProviders()194 195 if (self.internalCredentialsProvider?.identityId != nil) {196 if (federationProvider == .none) {197 currentUserState = .guest198 completionHandler(.guest, nil)199 } else {200 currentUserState = .signedIn201 completionHandler(.signedIn, nil)202 }203 } else if (self.cachedLoginsMap.count > 0) {204 currentUserState = .signedIn205 completionHandler(.signedIn, nil)206 } else {207 currentUserState = .signedOut208 completionHandler(.signedOut, nil)209 }210 } else if self.cachedLoginsMap.count > 0 {211 currentUserState = .signedIn212 completionHandler(.signedIn, nil)213 } else {214 currentUserState = .signedOut215 completionHandler(.signedOut, nil)216 }217 isInitialized = true218 }219 }220 221 222 /// Adds a listener who receives notifications on user state change.223 ///224 /// - Parameters:225 /// - object: The object who intends to receive notification. A strong reference is held to the object and the developer is required to call `removeUserStateListener` to stop getting notifications and release the object.226 /// - callback: Callback describing the new user state.227 public func addUserStateListener(_ object: AnyObject, _ callback: @escaping UserStateChangeCallback) {228 listeners.append((object, callback))229 }230 231 232 /// Removes a registered listener. If no listener exists, call is ignored.233 ///234 /// - Parameter object: The object to be de-registered from receiving notifications.235 public func removeUserStateListener(_ object: AnyObject) {236 listeners = listeners.filter { return !($0.0 === object)}237 }238 239 internal func mobileClientStatusChanged(userState: UserState, additionalInfo: [String: String]) {240 self.currentUserState = userState241 for listener in listeners {242 listener.1(userState, additionalInfo)243 }244 }245 246 247 /// Shows a fully managed sign in screen which allows users to sign up and sign in.248 ///249 /// - Parameters:250 /// - navigationController: The navigation controller which would act as the anchor for this UI.251 /// - signInUIOptions: The options object which allows changing logo, background color and if the user can cancel the sign in operation.252 /// - completionHandler: The completion handler to be called when user finishes the sign in action.253 public func showSignIn(navigationController: UINavigationController, signInUIOptions: SignInUIOptions = SignInUIOptions(), _ completionHandler: @escaping(UserState?, Error?) -> Void) {254 255 switch self.currentUserState {256 case .signedIn:257 completionHandler(nil, AWSMobileClientError.invalidState(message: "There is already a user which is signed in. Please log out the user before calling showSignIn."))258 return259 default:260 break261 }262 263 _AWSMobileClient.sharedInstance().showSign(inScreen: navigationController, signInUIConfiguration: signInUIOptions, completionHandler: { providerName, token, error in264 if error == nil {265 if (providerName == "graph.facebook.com") || (providerName == "accounts.googgle.com") {266 self.federatedSignIn(providerName: providerName!, token: token!, completionHandler: completionHandler)267 } else {268 self.currentUser?.getSession().continueWith(block: { (task) -> Any? in269 if let session = task.result {270 self.performUserPoolSuccessfulSignInTasks(session: session)271 completionHandler(.signedIn, nil)272 } else {273 completionHandler(nil, task.error)274 }275 return nil276 })277 }278 } else {279 if ((error! as NSError).domain == "AWSMobileClientError") {280 if error!._code == -1 {281 completionHandler(nil, AWSMobileClientError.invalidState(message: "AWSAuthUI dependency is required to show the signIn screen. Please import the dependency before using this API."))282 return283 } else if error!._code == -2 {284 completionHandler(nil, AWSMobileClientError.userCancelledSignIn(message: "The user cancelled the sign in operation."))285 return286 }287 }288 completionHandler(nil, error)289 }290 })291 }292}293// MARK: Inherited methods from AWSCognitoCredentialsProvider294extension AWSMobileClient {295 296 297 /// Asynchronously returns a valid AWS credentials or an error object if it cannot retrieve valid credentials. It should cache valid credentials as much as possible and refresh them when they are invalid.298 ///299 /// - Returns: A valid AWS credentials or an error object describing the error.300 override public func credentials() -> AWSTask<AWSCredentials> {301 let credentialsTaskCompletionSource: AWSTaskCompletionSource<AWSCredentials> = AWSTaskCompletionSource()302 303 self.getAWSCredentials { (credentials, error) in304 if let credentials = credentials {305 credentialsTaskCompletionSource.set(result: credentials)306 } else if let error = error {307 credentialsTaskCompletionSource.set(error: error)308 }309 }310 return credentialsTaskCompletionSource.task311 }312 313 314 /// Invalidates the cached temporary AWS credentials. If the credentials provider does not cache temporary credentials, this operation is a no-op.315 override public func invalidateCachedTemporaryCredentials() {316 self.internalCredentialsProvider?.invalidateCachedTemporaryCredentials()317 }318 319 320 /// Get/retrieve the identity id for this provider. If an identity id is already set on this provider, no remote call is made and the identity will be returned as a result of the AWSTask (the identityId is also available as a property). If no identityId is set on this provider, one will be retrieved from the service.321 ///322 /// - Returns: Asynchronous task which contains the identity id or error.323 override public func getIdentityId() -> AWSTask<NSString> {324 guard self.internalCredentialsProvider != nil else {325 return AWSTask(error: AWSMobileClientError.cognitoIdentityPoolNotConfigured(message: "Cannot get identityId since cognito credentials configuration is not available."))326 }327 let identityFetchTaskCompletionSource: AWSTaskCompletionSource<NSString> = AWSTaskCompletionSource()328 self.internalCredentialsProvider?.getIdentityId().continueWith(block: { (task) -> Any? in329 if let error = task.error {330 if error._domain == AWSCognitoCredentialsProviderHelperErrorDomain331 && error._code == AWSCognitoCredentialsProviderHelperErrorType.identityIsNil.rawValue {332 identityFetchTaskCompletionSource.set(error: AWSMobileClientError.identityIdUnavailable(message: "Fetching identity id on another thread failed. Please retry by calling `getIdentityId()` method."))333 } else {334 identityFetchTaskCompletionSource.set(error: error)335 }336 } else if let result = task.result {337 identityFetchTaskCompletionSource.set(result: result)338 }339 return nil340 })341 342 return identityFetchTaskCompletionSource.task343 }344 345 346 /// Clear the cached AWS credentials for this provider.347 override public func clearCredentials() {348 self.internalCredentialsProvider?.clearCredentials()349 }350 351 352 /// Clear ALL saved values for this provider (identityId, credentials, logins).353 override public func clearKeychain() {354 self.internalCredentialsProvider?.clearKeychain()355 }356 357}358// MARK: Deprecated AWSMobileClient methods359extension AWSMobileClient {360 361 @available(*, deprecated: 2.7, message: "This method will be removed in the next minor version. Please update to use AWSMobileClient using `initialize`. Please visit https://aws-amplify.github.io for the latest iOS documentation.")362 override public func interceptApplication(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any]? = nil) -> Bool {363 return _AWSMobileClient.sharedInstance().interceptApplication(application, didFinishLaunchingWithOptions: launchOptions)364 }365 366 @available(*, deprecated: 2.7, message: "This method will be removed in the next minor version. Please update to use AWSMobileClient using `initialize`. Please visit https://aws-amplify.github.io for the latest iOS documentation.")367 @objc override public func interceptApplication(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any]? = nil, resumeSessionWithCompletionHandler completionHandler: @escaping (Any, Error) -> Void) -> Bool {368 operateInLegacyMode = true369 return _AWSMobileClient.sharedInstance().interceptApplication(application,370 didFinishLaunchingWithOptions: launchOptions,371 resumeSessionWithCompletionHandler: completionHandler)372 }373 374 @available(*, deprecated: 2.7, message: "This method will be removed in the next minor version. Please update to use AWSMobileClient in the updated manner. Please visit https://aws-amplify.github.io for the latest iOS documentation")375 @objc override public func setSignInProviders(_ signInProviderConfig: [AWSSignInProviderConfig]?) {376 _AWSMobileClient.sharedInstance().setSignInProviders(signInProviderConfig)377 }378 379 /// Get the credentials provider object which provides `AWSCredentials`.380 ///381 /// - Returns: An object which implements `AWSCredentialsProvider`.382 @available(*, deprecated: 2.7, message: "This method will be removed in the next minor version. AWSMobileClient itself is a credentials provider now and should be passed directly where required. Please visit https://aws-amplify.github.io for the latest iOS documentation.")383 @objc override public func getCredentialsProvider() -> AWSCognitoCredentialsProvider {384 if (operateInLegacyMode) {385 return _AWSMobileClient.sharedInstance().getCredentialsProvider()386 } else {387 return self388 }389 }390 391}...

Full Screen

Full Screen

tempnam_variation4-1.phpt

Source:tempnam_variation4-1.phpt Github

copy

Full Screen

2Test tempnam() function: usage variations - permissions(0351 to 0777) of dir3--SKIPIF--4<?php5if (substr(PHP_OS, 0, 3) == 'WIN') {6 die('skip Not valid for Windows');7}8require __DIR__ . '/../skipif_root.inc';9?>10--FILE--11<?php12/* Trying to create the file in a dir with permissions from 0351 to 0777,13 Allowable permissions: files are expected to be created in the input dir14 Non-allowable permissions: files are expected to be created in '/tmp' dir15*/16echo "*** Testing tempnam() with dir of permissions from 0351 to 0777 ***\n";17$file_path = __DIR__;18$dir_name = $file_path."/tempnam_variation4-1";19$prefix = "tempnamVar4.";20mkdir($dir_name);21for($mode = 0351; $mode <= 0777; $mode++) {22 chmod($dir_name, $mode);23 $file_name = tempnam($dir_name, $prefix);24 if(file_exists($file_name) ) {25 if (dirname($file_name) != $dir_name) {26 /* Either there's a notice or error */27 printf("%o\n", $mode);28 if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {29 echo " created in unexpected dir\n";30 }31 }32 unlink($file_name);33 }34 else {35 print("FAILED: File is not created\n");36 }37}38rmdir($dir_name);39echo "*** Done ***\n";40?>41--EXPECTF--42*** Testing tempnam() with dir of permissions from 0351 to 0777 ***43Notice: tempnam(): file created in the system's temporary directory in %s on line %d4440045Notice: tempnam(): file created in the system's temporary directory in %s on line %d4640147Notice: tempnam(): file created in the system's temporary directory in %s on line %d4840249Notice: tempnam(): file created in the system's temporary directory in %s on line %d5040351Notice: tempnam(): file created in the system's temporary directory in %s on line %d5240453Notice: tempnam(): file created in the system's temporary directory in %s on line %d5440555Notice: tempnam(): file created in the system's temporary directory in %s on line %d5640657Notice: tempnam(): file created in the system's temporary directory in %s on line %d5840759Notice: tempnam(): file created in the system's temporary directory in %s on line %d6041061Notice: tempnam(): file created in the system's temporary directory in %s on line %d6241163Notice: tempnam(): file created in the system's temporary directory in %s on line %d6441265Notice: tempnam(): file created in the system's temporary directory in %s on line %d6641367Notice: tempnam(): file created in the system's temporary directory in %s on line %d6841469Notice: tempnam(): file created in the system's temporary directory in %s on line %d7041571Notice: tempnam(): file created in the system's temporary directory in %s on line %d7241673Notice: tempnam(): file created in the system's temporary directory in %s on line %d7441775Notice: tempnam(): file created in the system's temporary directory in %s on line %d7642077Notice: tempnam(): file created in the system's temporary directory in %s on line %d7842179Notice: tempnam(): file created in the system's temporary directory in %s on line %d8042281Notice: tempnam(): file created in the system's temporary directory in %s on line %d8242383Notice: tempnam(): file created in the system's temporary directory in %s on line %d8442485Notice: tempnam(): file created in the system's temporary directory in %s on line %d8642587Notice: tempnam(): file created in the system's temporary directory in %s on line %d8842689Notice: tempnam(): file created in the system's temporary directory in %s on line %d9042791Notice: tempnam(): file created in the system's temporary directory in %s on line %d9243093Notice: tempnam(): file created in the system's temporary directory in %s on line %d9443195Notice: tempnam(): file created in the system's temporary directory in %s on line %d9643297Notice: tempnam(): file created in the system's temporary directory in %s on line %d9843399Notice: tempnam(): file created in the system's temporary directory in %s on line %d100434101Notice: tempnam(): file created in the system's temporary directory in %s on line %d102435103Notice: tempnam(): file created in the system's temporary directory in %s on line %d104436105Notice: tempnam(): file created in the system's temporary directory in %s on line %d106437107Notice: tempnam(): file created in the system's temporary directory in %s on line %d108440109Notice: tempnam(): file created in the system's temporary directory in %s on line %d110441111Notice: tempnam(): file created in the system's temporary directory in %s on line %d112442113Notice: tempnam(): file created in the system's temporary directory in %s on line %d114443115Notice: tempnam(): file created in the system's temporary directory in %s on line %d116444117Notice: tempnam(): file created in the system's temporary directory in %s on line %d118445119Notice: tempnam(): file created in the system's temporary directory in %s on line %d120446121Notice: tempnam(): file created in the system's temporary directory in %s on line %d122447123Notice: tempnam(): file created in the system's temporary directory in %s on line %d124450125Notice: tempnam(): file created in the system's temporary directory in %s on line %d126451127Notice: tempnam(): file created in the system's temporary directory in %s on line %d128452129Notice: tempnam(): file created in the system's temporary directory in %s on line %d130453131Notice: tempnam(): file created in the system's temporary directory in %s on line %d132454133Notice: tempnam(): file created in the system's temporary directory in %s on line %d134455135Notice: tempnam(): file created in the system's temporary directory in %s on line %d136456137Notice: tempnam(): file created in the system's temporary directory in %s on line %d138457139Notice: tempnam(): file created in the system's temporary directory in %s on line %d140460141Notice: tempnam(): file created in the system's temporary directory in %s on line %d142461143Notice: tempnam(): file created in the system's temporary directory in %s on line %d144462145Notice: tempnam(): file created in the system's temporary directory in %s on line %d146463147Notice: tempnam(): file created in the system's temporary directory in %s on line %d148464149Notice: tempnam(): file created in the system's temporary directory in %s on line %d150465151Notice: tempnam(): file created in the system's temporary directory in %s on line %d152466153Notice: tempnam(): file created in the system's temporary directory in %s on line %d154467155Notice: tempnam(): file created in the system's temporary directory in %s on line %d156470157Notice: tempnam(): file created in the system's temporary directory in %s on line %d158471159Notice: tempnam(): file created in the system's temporary directory in %s on line %d160472161Notice: tempnam(): file created in the system's temporary directory in %s on line %d162473163Notice: tempnam(): file created in the system's temporary directory in %s on line %d164474165Notice: tempnam(): file created in the system's temporary directory in %s on line %d166475167Notice: tempnam(): file created in the system's temporary directory in %s on line %d168476169Notice: tempnam(): file created in the system's temporary directory in %s on line %d170477171Notice: tempnam(): file created in the system's temporary directory in %s on line %d172500173Notice: tempnam(): file created in the system's temporary directory in %s on line %d174501175Notice: tempnam(): file created in the system's temporary directory in %s on line %d176502177Notice: tempnam(): file created in the system's temporary directory in %s on line %d178503179Notice: tempnam(): file created in the system's temporary directory in %s on line %d180504181Notice: tempnam(): file created in the system's temporary directory in %s on line %d182505183Notice: tempnam(): file created in the system's temporary directory in %s on line %d184506185Notice: tempnam(): file created in the system's temporary directory in %s on line %d186507187Notice: tempnam(): file created in the system's temporary directory in %s on line %d188510189Notice: tempnam(): file created in the system's temporary directory in %s on line %d190511191Notice: tempnam(): file created in the system's temporary directory in %s on line %d192512193Notice: tempnam(): file created in the system's temporary directory in %s on line %d194513195Notice: tempnam(): file created in the system's temporary directory in %s on line %d196514197Notice: tempnam(): file created in the system's temporary directory in %s on line %d198515199Notice: tempnam(): file created in the system's temporary directory in %s on line %d200516201Notice: tempnam(): file created in the system's temporary directory in %s on line %d202517203Notice: tempnam(): file created in the system's temporary directory in %s on line %d204520205Notice: tempnam(): file created in the system's temporary directory in %s on line %d206521207Notice: tempnam(): file created in the system's temporary directory in %s on line %d208522209Notice: tempnam(): file created in the system's temporary directory in %s on line %d210523211Notice: tempnam(): file created in the system's temporary directory in %s on line %d212524213Notice: tempnam(): file created in the system's temporary directory in %s on line %d214525215Notice: tempnam(): file created in the system's temporary directory in %s on line %d216526217Notice: tempnam(): file created in the system's temporary directory in %s on line %d218527219Notice: tempnam(): file created in the system's temporary directory in %s on line %d220530221Notice: tempnam(): file created in the system's temporary directory in %s on line %d222531223Notice: tempnam(): file created in the system's temporary directory in %s on line %d224532225Notice: tempnam(): file created in the system's temporary directory in %s on line %d226533227Notice: tempnam(): file created in the system's temporary directory in %s on line %d228534229Notice: tempnam(): file created in the system's temporary directory in %s on line %d230535231Notice: tempnam(): file created in the system's temporary directory in %s on line %d232536233Notice: tempnam(): file created in the system's temporary directory in %s on line %d234537235Notice: tempnam(): file created in the system's temporary directory in %s on line %d236540237Notice: tempnam(): file created in the system's temporary directory in %s on line %d238541239Notice: tempnam(): file created in the system's temporary directory in %s on line %d240542241Notice: tempnam(): file created in the system's temporary directory in %s on line %d242543243Notice: tempnam(): file created in the system's temporary directory in %s on line %d244544245Notice: tempnam(): file created in the system's temporary directory in %s on line %d246545247Notice: tempnam(): file created in the system's temporary directory in %s on line %d248546249Notice: tempnam(): file created in the system's temporary directory in %s on line %d250547251Notice: tempnam(): file created in the system's temporary directory in %s on line %d252550253Notice: tempnam(): file created in the system's temporary directory in %s on line %d254551255Notice: tempnam(): file created in the system's temporary directory in %s on line %d256552257Notice: tempnam(): file created in the system's temporary directory in %s on line %d258553259Notice: tempnam(): file created in the system's temporary directory in %s on line %d260554261Notice: tempnam(): file created in the system's temporary directory in %s on line %d262555263Notice: tempnam(): file created in the system's temporary directory in %s on line %d264556265Notice: tempnam(): file created in the system's temporary directory in %s on line %d266557267Notice: tempnam(): file created in the system's temporary directory in %s on line %d268560269Notice: tempnam(): file created in the system's temporary directory in %s on line %d270561271Notice: tempnam(): file created in the system's temporary directory in %s on line %d272562273Notice: tempnam(): file created in the system's temporary directory in %s on line %d274563275Notice: tempnam(): file created in the system's temporary directory in %s on line %d276564277Notice: tempnam(): file created in the system's temporary directory in %s on line %d278565279Notice: tempnam(): file created in the system's temporary directory in %s on line %d280566281Notice: tempnam(): file created in the system's temporary directory in %s on line %d282567283Notice: tempnam(): file created in the system's temporary directory in %s on line %d284570285Notice: tempnam(): file created in the system's temporary directory in %s on line %d286571287Notice: tempnam(): file created in the system's temporary directory in %s on line %d288572289Notice: tempnam(): file created in the system's temporary directory in %s on line %d290573291Notice: tempnam(): file created in the system's temporary directory in %s on line %d292574293Notice: tempnam(): file created in the system's temporary directory in %s on line %d294575295Notice: tempnam(): file created in the system's temporary directory in %s on line %d296576297Notice: tempnam(): file created in the system's temporary directory in %s on line %d298577299Notice: tempnam(): file created in the system's temporary directory in %s on line %d300600301Notice: tempnam(): file created in the system's temporary directory in %s on line %d302601303Notice: tempnam(): file created in the system's temporary directory in %s on line %d304602305Notice: tempnam(): file created in the system's temporary directory in %s on line %d306603307Notice: tempnam(): file created in the system's temporary directory in %s on line %d308604309Notice: tempnam(): file created in the system's temporary directory in %s on line %d310605311Notice: tempnam(): file created in the system's temporary directory in %s on line %d312606313Notice: tempnam(): file created in the system's temporary directory in %s on line %d314607315Notice: tempnam(): file created in the system's temporary directory in %s on line %d316610317Notice: tempnam(): file created in the system's temporary directory in %s on line %d318611319Notice: tempnam(): file created in the system's temporary directory in %s on line %d320612321Notice: tempnam(): file created in the system's temporary directory in %s on line %d322613323Notice: tempnam(): file created in the system's temporary directory in %s on line %d324614325Notice: tempnam(): file created in the system's temporary directory in %s on line %d326615327Notice: tempnam(): file created in the system's temporary directory in %s on line %d328616329Notice: tempnam(): file created in the system's temporary directory in %s on line %d330617331Notice: tempnam(): file created in the system's temporary directory in %s on line %d332620333Notice: tempnam(): file created in the system's temporary directory in %s on line %d334621335Notice: tempnam(): file created in the system's temporary directory in %s on line %d336622337Notice: tempnam(): file created in the system's temporary directory in %s on line %d338623339Notice: tempnam(): file created in the system's temporary directory in %s on line %d340624341Notice: tempnam(): file created in the system's temporary directory in %s on line %d342625343Notice: tempnam(): file created in the system's temporary directory in %s on line %d344626345Notice: tempnam(): file created in the system's temporary directory in %s on line %d346627347Notice: tempnam(): file created in the system's temporary directory in %s on line %d348630349Notice: tempnam(): file created in the system's temporary directory in %s on line %d350631351Notice: tempnam(): file created in the system's temporary directory in %s on line %d352632353Notice: tempnam(): file created in the system's temporary directory in %s on line %d354633355Notice: tempnam(): file created in the system's temporary directory in %s on line %d356634357Notice: tempnam(): file created in the system's temporary directory in %s on line %d358635359Notice: tempnam(): file created in the system's temporary directory in %s on line %d360636361Notice: tempnam(): file created in the system's temporary directory in %s on line %d362637363Notice: tempnam(): file created in the system's temporary directory in %s on line %d364640365Notice: tempnam(): file created in the system's temporary directory in %s on line %d366641367Notice: tempnam(): file created in the system's temporary directory in %s on line %d368642369Notice: tempnam(): file created in the system's temporary directory in %s on line %d370643371Notice: tempnam(): file created in the system's temporary directory in %s on line %d372644373Notice: tempnam(): file created in the system's temporary directory in %s on line %d374645375Notice: tempnam(): file created in the system's temporary directory in %s on line %d376646377Notice: tempnam(): file created in the system's temporary directory in %s on line %d378647379Notice: tempnam(): file created in the system's temporary directory in %s on line %d380650381Notice: tempnam(): file created in the system's temporary directory in %s on line %d382651383Notice: tempnam(): file created in the system's temporary directory in %s on line %d384652385Notice: tempnam(): file created in the system's temporary directory in %s on line %d386653387Notice: tempnam(): file created in the system's temporary directory in %s on line %d388654389Notice: tempnam(): file created in the system's temporary directory in %s on line %d390655391Notice: tempnam(): file created in the system's temporary directory in %s on line %d392656393Notice: tempnam(): file created in the system's temporary directory in %s on line %d394657395Notice: tempnam(): file created in the system's temporary directory in %s on line %d396660397Notice: tempnam(): file created in the system's temporary directory in %s on line %d398661399Notice: tempnam(): file created in the system's temporary directory in %s on line %d400662401Notice: tempnam(): file created in the system's temporary directory in %s on line %d402663403Notice: tempnam(): file created in the system's temporary directory in %s on line %d404664405Notice: tempnam(): file created in the system's temporary directory in %s on line %d406665407Notice: tempnam(): file created in the system's temporary directory in %s on line %d408666409Notice: tempnam(): file created in the system's temporary directory in %s on line %d410667411Notice: tempnam(): file created in the system's temporary directory in %s on line %d412670413Notice: tempnam(): file created in the system's temporary directory in %s on line %d414671415Notice: tempnam(): file created in the system's temporary directory in %s on line %d416672417Notice: tempnam(): file created in the system's temporary directory in %s on line %d418673419Notice: tempnam(): file created in the system's temporary directory in %s on line %d420674421Notice: tempnam(): file created in the system's temporary directory in %s on line %d422675423Notice: tempnam(): file created in the system's temporary directory in %s on line %d424676425Notice: tempnam(): file created in the system's temporary directory in %s on line %d426677427*** Done ***...

Full Screen

Full Screen

tempnam_variation4-0.phpt

Source:tempnam_variation4-0.phpt Github

copy

Full Screen

2Test tempnam() function: usage variations - permissions(0000 to 0350) of dir3--SKIPIF--4<?php5if (substr(PHP_OS, 0, 3) == 'WIN') {6 die('skip Not valid for Windows');7}8require __DIR__ . '/../skipif_root.inc';9?>10--FILE--11<?php12/* Trying to create the file in a dir with permissions from 0000 to 0350,13 Allowable permissions: files are expected to be created in the input dir14 Non-allowable permissions: files are expected to be created in '/tmp' dir15*/16echo "*** Testing tempnam() with dir of permissions from 0000 to 0350 ***\n";17$file_path = __DIR__;18$dir_name = $file_path."/tempnam_variation4-0";19$prefix = "tempnamVar4.";20mkdir($dir_name);21for($mode = 0000; $mode <= 0350; $mode++) {22 chmod($dir_name, $mode);23 $file_name = tempnam($dir_name, $prefix);24 if(file_exists($file_name) ) {25 if (dirname($file_name) != $dir_name) {26 /* Either there's a notice or error */27 printf("%o\n", $mode);28 if (realpath(dirname($file_name)) != realpath(sys_get_temp_dir())) {29 echo " created in unexpected dir\n";30 }31 }32 unlink($file_name);33 }34 else {35 print("FAILED: File is not created\n");36 }37}38rmdir($dir_name);39echo "*** Done ***\n";40?>41--EXPECTF--42*** Testing tempnam() with dir of permissions from 0000 to 0350 ***43Notice: tempnam(): file created in the system's temporary directory in %s on line %d44Notice: tempnam(): file created in the system's temporary directory in %s on line %d45146Notice: tempnam(): file created in the system's temporary directory in %s on line %d47248Notice: tempnam(): file created in the system's temporary directory in %s on line %d49350Notice: tempnam(): file created in the system's temporary directory in %s on line %d51452Notice: tempnam(): file created in the system's temporary directory in %s on line %d53554Notice: tempnam(): file created in the system's temporary directory in %s on line %d55656Notice: tempnam(): file created in the system's temporary directory in %s on line %d57758Notice: tempnam(): file created in the system's temporary directory in %s on line %d591060Notice: tempnam(): file created in the system's temporary directory in %s on line %d611162Notice: tempnam(): file created in the system's temporary directory in %s on line %d631264Notice: tempnam(): file created in the system's temporary directory in %s on line %d651366Notice: tempnam(): file created in the system's temporary directory in %s on line %d671468Notice: tempnam(): file created in the system's temporary directory in %s on line %d691570Notice: tempnam(): file created in the system's temporary directory in %s on line %d711672Notice: tempnam(): file created in the system's temporary directory in %s on line %d731774Notice: tempnam(): file created in the system's temporary directory in %s on line %d752076Notice: tempnam(): file created in the system's temporary directory in %s on line %d772178Notice: tempnam(): file created in the system's temporary directory in %s on line %d792280Notice: tempnam(): file created in the system's temporary directory in %s on line %d812382Notice: tempnam(): file created in the system's temporary directory in %s on line %d832484Notice: tempnam(): file created in the system's temporary directory in %s on line %d852586Notice: tempnam(): file created in the system's temporary directory in %s on line %d872688Notice: tempnam(): file created in the system's temporary directory in %s on line %d892790Notice: tempnam(): file created in the system's temporary directory in %s on line %d913092Notice: tempnam(): file created in the system's temporary directory in %s on line %d933194Notice: tempnam(): file created in the system's temporary directory in %s on line %d953296Notice: tempnam(): file created in the system's temporary directory in %s on line %d973398Notice: tempnam(): file created in the system's temporary directory in %s on line %d9934100Notice: tempnam(): file created in the system's temporary directory in %s on line %d10135102Notice: tempnam(): file created in the system's temporary directory in %s on line %d10336104Notice: tempnam(): file created in the system's temporary directory in %s on line %d10537106Notice: tempnam(): file created in the system's temporary directory in %s on line %d10740108Notice: tempnam(): file created in the system's temporary directory in %s on line %d10941110Notice: tempnam(): file created in the system's temporary directory in %s on line %d11142112Notice: tempnam(): file created in the system's temporary directory in %s on line %d11343114Notice: tempnam(): file created in the system's temporary directory in %s on line %d11544116Notice: tempnam(): file created in the system's temporary directory in %s on line %d11745118Notice: tempnam(): file created in the system's temporary directory in %s on line %d11946120Notice: tempnam(): file created in the system's temporary directory in %s on line %d12147122Notice: tempnam(): file created in the system's temporary directory in %s on line %d12350124Notice: tempnam(): file created in the system's temporary directory in %s on line %d12551126Notice: tempnam(): file created in the system's temporary directory in %s on line %d12752128Notice: tempnam(): file created in the system's temporary directory in %s on line %d12953130Notice: tempnam(): file created in the system's temporary directory in %s on line %d13154132Notice: tempnam(): file created in the system's temporary directory in %s on line %d13355134Notice: tempnam(): file created in the system's temporary directory in %s on line %d13556136Notice: tempnam(): file created in the system's temporary directory in %s on line %d13757138Notice: tempnam(): file created in the system's temporary directory in %s on line %d13960140Notice: tempnam(): file created in the system's temporary directory in %s on line %d14161142Notice: tempnam(): file created in the system's temporary directory in %s on line %d14362144Notice: tempnam(): file created in the system's temporary directory in %s on line %d14563146Notice: tempnam(): file created in the system's temporary directory in %s on line %d14764148Notice: tempnam(): file created in the system's temporary directory in %s on line %d14965150Notice: tempnam(): file created in the system's temporary directory in %s on line %d15166152Notice: tempnam(): file created in the system's temporary directory in %s on line %d15367154Notice: tempnam(): file created in the system's temporary directory in %s on line %d15570156Notice: tempnam(): file created in the system's temporary directory in %s on line %d15771158Notice: tempnam(): file created in the system's temporary directory in %s on line %d15972160Notice: tempnam(): file created in the system's temporary directory in %s on line %d16173162Notice: tempnam(): file created in the system's temporary directory in %s on line %d16374164Notice: tempnam(): file created in the system's temporary directory in %s on line %d16575166Notice: tempnam(): file created in the system's temporary directory in %s on line %d16776168Notice: tempnam(): file created in the system's temporary directory in %s on line %d16977170Notice: tempnam(): file created in the system's temporary directory in %s on line %d171100172Notice: tempnam(): file created in the system's temporary directory in %s on line %d173101174Notice: tempnam(): file created in the system's temporary directory in %s on line %d175102176Notice: tempnam(): file created in the system's temporary directory in %s on line %d177103178Notice: tempnam(): file created in the system's temporary directory in %s on line %d179104180Notice: tempnam(): file created in the system's temporary directory in %s on line %d181105182Notice: tempnam(): file created in the system's temporary directory in %s on line %d183106184Notice: tempnam(): file created in the system's temporary directory in %s on line %d185107186Notice: tempnam(): file created in the system's temporary directory in %s on line %d187110188Notice: tempnam(): file created in the system's temporary directory in %s on line %d189111190Notice: tempnam(): file created in the system's temporary directory in %s on line %d191112192Notice: tempnam(): file created in the system's temporary directory in %s on line %d193113194Notice: tempnam(): file created in the system's temporary directory in %s on line %d195114196Notice: tempnam(): file created in the system's temporary directory in %s on line %d197115198Notice: tempnam(): file created in the system's temporary directory in %s on line %d199116200Notice: tempnam(): file created in the system's temporary directory in %s on line %d201117202Notice: tempnam(): file created in the system's temporary directory in %s on line %d203120204Notice: tempnam(): file created in the system's temporary directory in %s on line %d205121206Notice: tempnam(): file created in the system's temporary directory in %s on line %d207122208Notice: tempnam(): file created in the system's temporary directory in %s on line %d209123210Notice: tempnam(): file created in the system's temporary directory in %s on line %d211124212Notice: tempnam(): file created in the system's temporary directory in %s on line %d213125214Notice: tempnam(): file created in the system's temporary directory in %s on line %d215126216Notice: tempnam(): file created in the system's temporary directory in %s on line %d217127218Notice: tempnam(): file created in the system's temporary directory in %s on line %d219130220Notice: tempnam(): file created in the system's temporary directory in %s on line %d221131222Notice: tempnam(): file created in the system's temporary directory in %s on line %d223132224Notice: tempnam(): file created in the system's temporary directory in %s on line %d225133226Notice: tempnam(): file created in the system's temporary directory in %s on line %d227134228Notice: tempnam(): file created in the system's temporary directory in %s on line %d229135230Notice: tempnam(): file created in the system's temporary directory in %s on line %d231136232Notice: tempnam(): file created in the system's temporary directory in %s on line %d233137234Notice: tempnam(): file created in the system's temporary directory in %s on line %d235140236Notice: tempnam(): file created in the system's temporary directory in %s on line %d237141238Notice: tempnam(): file created in the system's temporary directory in %s on line %d239142240Notice: tempnam(): file created in the system's temporary directory in %s on line %d241143242Notice: tempnam(): file created in the system's temporary directory in %s on line %d243144244Notice: tempnam(): file created in the system's temporary directory in %s on line %d245145246Notice: tempnam(): file created in the system's temporary directory in %s on line %d247146248Notice: tempnam(): file created in the system's temporary directory in %s on line %d249147250Notice: tempnam(): file created in the system's temporary directory in %s on line %d251150252Notice: tempnam(): file created in the system's temporary directory in %s on line %d253151254Notice: tempnam(): file created in the system's temporary directory in %s on line %d255152256Notice: tempnam(): file created in the system's temporary directory in %s on line %d257153258Notice: tempnam(): file created in the system's temporary directory in %s on line %d259154260Notice: tempnam(): file created in the system's temporary directory in %s on line %d261155262Notice: tempnam(): file created in the system's temporary directory in %s on line %d263156264Notice: tempnam(): file created in the system's temporary directory in %s on line %d265157266Notice: tempnam(): file created in the system's temporary directory in %s on line %d267160268Notice: tempnam(): file created in the system's temporary directory in %s on line %d269161270Notice: tempnam(): file created in the system's temporary directory in %s on line %d271162272Notice: tempnam(): file created in the system's temporary directory in %s on line %d273163274Notice: tempnam(): file created in the system's temporary directory in %s on line %d275164276Notice: tempnam(): file created in the system's temporary directory in %s on line %d277165278Notice: tempnam(): file created in the system's temporary directory in %s on line %d279166280Notice: tempnam(): file created in the system's temporary directory in %s on line %d281167282Notice: tempnam(): file created in the system's temporary directory in %s on line %d283170284Notice: tempnam(): file created in the system's temporary directory in %s on line %d285171286Notice: tempnam(): file created in the system's temporary directory in %s on line %d287172288Notice: tempnam(): file created in the system's temporary directory in %s on line %d289173290Notice: tempnam(): file created in the system's temporary directory in %s on line %d291174292Notice: tempnam(): file created in the system's temporary directory in %s on line %d293175294Notice: tempnam(): file created in the system's temporary directory in %s on line %d295176296Notice: tempnam(): file created in the system's temporary directory in %s on line %d297177298Notice: tempnam(): file created in the system's temporary directory in %s on line %d299200300Notice: tempnam(): file created in the system's temporary directory in %s on line %d301201302Notice: tempnam(): file created in the system's temporary directory in %s on line %d303202304Notice: tempnam(): file created in the system's temporary directory in %s on line %d305203306Notice: tempnam(): file created in the system's temporary directory in %s on line %d307204308Notice: tempnam(): file created in the system's temporary directory in %s on line %d309205310Notice: tempnam(): file created in the system's temporary directory in %s on line %d311206312Notice: tempnam(): file created in the system's temporary directory in %s on line %d313207314Notice: tempnam(): file created in the system's temporary directory in %s on line %d315210316Notice: tempnam(): file created in the system's temporary directory in %s on line %d317211318Notice: tempnam(): file created in the system's temporary directory in %s on line %d319212320Notice: tempnam(): file created in the system's temporary directory in %s on line %d321213322Notice: tempnam(): file created in the system's temporary directory in %s on line %d323214324Notice: tempnam(): file created in the system's temporary directory in %s on line %d325215326Notice: tempnam(): file created in the system's temporary directory in %s on line %d327216328Notice: tempnam(): file created in the system's temporary directory in %s on line %d329217330Notice: tempnam(): file created in the system's temporary directory in %s on line %d331220332Notice: tempnam(): file created in the system's temporary directory in %s on line %d333221334Notice: tempnam(): file created in the system's temporary directory in %s on line %d335222336Notice: tempnam(): file created in the system's temporary directory in %s on line %d337223338Notice: tempnam(): file created in the system's temporary directory in %s on line %d339224340Notice: tempnam(): file created in the system's temporary directory in %s on line %d341225342Notice: tempnam(): file created in the system's temporary directory in %s on line %d343226344Notice: tempnam(): file created in the system's temporary directory in %s on line %d345227346Notice: tempnam(): file created in the system's temporary directory in %s on line %d347230348Notice: tempnam(): file created in the system's temporary directory in %s on line %d349231350Notice: tempnam(): file created in the system's temporary directory in %s on line %d351232352Notice: tempnam(): file created in the system's temporary directory in %s on line %d353233354Notice: tempnam(): file created in the system's temporary directory in %s on line %d355234356Notice: tempnam(): file created in the system's temporary directory in %s on line %d357235358Notice: tempnam(): file created in the system's temporary directory in %s on line %d359236360Notice: tempnam(): file created in the system's temporary directory in %s on line %d361237362Notice: tempnam(): file created in the system's temporary directory in %s on line %d363240364Notice: tempnam(): file created in the system's temporary directory in %s on line %d365241366Notice: tempnam(): file created in the system's temporary directory in %s on line %d367242368Notice: tempnam(): file created in the system's temporary directory in %s on line %d369243370Notice: tempnam(): file created in the system's temporary directory in %s on line %d371244372Notice: tempnam(): file created in the system's temporary directory in %s on line %d373245374Notice: tempnam(): file created in the system's temporary directory in %s on line %d375246376Notice: tempnam(): file created in the system's temporary directory in %s on line %d377247378Notice: tempnam(): file created in the system's temporary directory in %s on line %d379250380Notice: tempnam(): file created in the system's temporary directory in %s on line %d381251382Notice: tempnam(): file created in the system's temporary directory in %s on line %d383252384Notice: tempnam(): file created in the system's temporary directory in %s on line %d385253386Notice: tempnam(): file created in the system's temporary directory in %s on line %d387254388Notice: tempnam(): file created in the system's temporary directory in %s on line %d389255390Notice: tempnam(): file created in the system's temporary directory in %s on line %d391256392Notice: tempnam(): file created in the system's temporary directory in %s on line %d393257394Notice: tempnam(): file created in the system's temporary directory in %s on line %d395260396Notice: tempnam(): file created in the system's temporary directory in %s on line %d397261398Notice: tempnam(): file created in the system's temporary directory in %s on line %d399262400Notice: tempnam(): file created in the system's temporary directory in %s on line %d401263402Notice: tempnam(): file created in the system's temporary directory in %s on line %d403264404Notice: tempnam(): file created in the system's temporary directory in %s on line %d405265406Notice: tempnam(): file created in the system's temporary directory in %s on line %d407266408Notice: tempnam(): file created in the system's temporary directory in %s on line %d409267410Notice: tempnam(): file created in the system's temporary directory in %s on line %d411270412Notice: tempnam(): file created in the system's temporary directory in %s on line %d413271414Notice: tempnam(): file created in the system's temporary directory in %s on line %d415272416Notice: tempnam(): file created in the system's temporary directory in %s on line %d417273418Notice: tempnam(): file created in the system's temporary directory in %s on line %d419274420Notice: tempnam(): file created in the system's temporary directory in %s on line %d421275422Notice: tempnam(): file created in the system's temporary directory in %s on line %d423276424Notice: tempnam(): file created in the system's temporary directory in %s on line %d425277426*** Done ***...

Full Screen

Full Screen

Shape.swift

Source:Shape.swift Github

copy

Full Screen

1postfix operator ′ // unicode character "Prime": U+20322public postfix func ′<Element : MatrixElement>(vector : Vector<Element>) -> Matrix<Element> {3 return Matrix(row: vector.map { x in x.adjoint })4}5public postfix func ′<Element : MatrixElement>(matrix : Matrix<Element>) -> Matrix<Element> {6 return matrix.adjoint7}8public typealias BlockMatrix<Element : MatrixElement> = Matrix<Matrix<Element>>9public extension Matrix {10 11 internal mutating func transposeInPlace() {12 if _rows > 1 && _columns > 1 {13 var transposedElements = elements14 asPointer(elements) { elements in15 asMutablePointer(&transposedElements) { transposedElements in16 for r in 0 ..< _rows {17 for c in 0 ..< _columns {18 let sourceIndex = c * _rows + r19 let targetIndex = r * _columns + c20 transposedElements[targetIndex] = elements[sourceIndex]21 }22 }23 }24 }25 elements = transposedElements26 }27 swap(&_rows, &_columns)28 }29 30 var transpose : Matrix {31 var m = self32 m.transposeInPlace()33 return m34 }35 36 internal mutating func adjointInPlace() {37 var transposedElements = elements38 asPointer(elements) { elements in39 asMutablePointer(&transposedElements) { transposedElements in40 for r in 0 ..< _rows {41 for c in 0 ..< _columns {42 let sourceIndex = c * _rows + r43 let targetIndex = r * _columns + c44 transposedElements[targetIndex] = elements[sourceIndex].adjoint45 }46 }47 }48 }49 elements = transposedElements50 swap(&_rows, &_columns)51 }52 53 var adjoint: Matrix {54 var m = self55 m.adjointInPlace()56 return m57 }58 func column(_ c : Int) -> Matrix {59 precondition(c >= 0 && c < _columns)60 let start = c * _rows61 return Matrix(Array(elements[start ..< start + _rows]))62 }63 64 func row(_ r : Int) -> Matrix {65 precondition(r >= 0 && r < _rows)66 let elems = (0 ..< _columns).map { c in self[r, c] }67 return Matrix(row: elems)68 }69 70 mutating func reshape(rows : Int, columns : Int) {71 precondition(rows * columns == count)72 self._rows = rows73 self._columns = columns74 }75 76 func reshaped(rows : Int, columns : Int) -> Matrix {77 var A = self78 A.reshape(rows: rows, columns: columns)79 return A80 }81 82 mutating func extend(rows : Int, columns : Int, with : Element = .zero) {83 guard rows > _rows || columns > _columns else { return }84 var result = Matrix(repeating: with, rows: max(_rows, rows), columns: max(_columns, columns))85 result[0 ..< _rows, 0 ..< _columns] = self86 self = result87 }88 89 mutating func extend(rows : Int, with : Element = .zero) {90 extend(rows: rows, columns: columns, with: with)91 }92 93 mutating func extend(columns : Int, with : Element = .zero) {94 extend(rows: rows, columns: columns, with: with)95 }96 97 /// - todo: This is a naive implementation, needs to be optimized.98 subscript <R : Collection, C : Collection>(rowIndices : R, columnIndices : C) -> Matrix where R.Element == Int, C.Element == Int {99 get {100 var elems : [Element] = []101 for c in columnIndices {102 for r in rowIndices {103 elems.append(self[r, c])104 }105 }106 return Matrix(rows: rowIndices.count, columns: columnIndices.count, elements: elems)107 }108 set {109 precondition(newValue.rows == rowIndices.count && newValue.columns == columnIndices.count)110 var index = 0111 let elems = newValue.elements112 for c in columnIndices {113 for r in rowIndices {114 self[r, c] = elems[index]115 index += 1116 }117 }118 }119 }120 121 init(columns : [Vector<Element>]) {122 var matrix = BlockMatrix<Element>(rows : 1, columns : columns.count)123 for (i, column) in columns.enumerated() {124 matrix[0, i] = Matrix(column)125 }126 self = flatten(matrix)127 }128 init(rows : [Vector<Element>]) {129 var matrix = BlockMatrix<Element>(rows : rows.count, columns : 1)130 for (i, row) in rows.enumerated() {131 matrix[i, 0] = Matrix(row: row)132 }133 self = flatten(matrix)134 }135 init(stackHorizontally stack: [Matrix<Element>]) {136 var matrix = BlockMatrix<Element>(rows : 1, columns : stack.count)137 for (i, m) in stack.enumerated() {138 matrix[0, i] = m139 }140 self = flatten(matrix)141 }142 init(stackVertically stack: [Matrix<Element>]) {143 var matrix = BlockMatrix<Element>(rows : stack.count, columns : 1)144 for (i, m) in stack.enumerated() {145 matrix[i, 0] = m146 }147 self = flatten(matrix)148 }149 150 var isQuasiUpperTriangle : Bool {151 let n = rows152 for c in 0 ..< columns {153 var r = c + 2154 while r < n {155 if self[r, c] != .zero { return false }156 r += 1157 }158 }159 return true160 }161 var isUpperTriangle : Bool {162 let n = rows163 for c in 0 ..< columns {164 var r = c + 1165 while r < n {166 if self[r, c] != .zero { return false }167 r += 1168 }169 }170 return true171 }172 173}174public func flatten<E : MatrixElement>(_ matrix : BlockMatrix<E>) -> Matrix<E> {175 var rowHeights = [Int](repeating: 0, count: matrix.rows)176 var columnWidths = [Int](repeating: 0, count: matrix.columns)177 var totalRows = 0178 var totalColumns = 0179 for r in 0 ..< matrix.rows {180 var height = 0181 for c in 0 ..< matrix.columns {182 height = max(height, matrix[r, c].rows)183 }184 rowHeights[r] = height185 totalRows += height186 }187 for c in 0 ..< matrix.columns {188 var width = 0189 for r in 0 ..< matrix.rows {190 width = max(width, matrix[r, c].columns)191 }192 columnWidths[c] = width193 totalColumns += width194 }195 var result = Matrix<E>(rows: totalRows, columns: totalColumns)196 var targetColumn = 0197 for c in 0 ..< matrix.columns {198 var targetRow = 0199 for r in 0 ..< matrix.rows {200 let m = matrix[r, c]201 result[targetRow ..< targetRow + m.rows, targetColumn ..< targetColumn + m.columns] = m202 targetRow += rowHeights[r]203 }204 targetColumn += columnWidths[c]205 }206 return result207}...

Full Screen

Full Screen

TimingMode.swift

Source:TimingMode.swift Github

copy

Full Screen

1//2// TimingMode.swift3// Animo4//5// Copyright © 2016 eureka, Inc.6//7// Permission is hereby granted, free of charge, to any person obtaining a copy8// of this software and associated documentation files (the "Software"), to deal9// in the Software without restriction, including without limitation the rights10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell11// copies of the Software, and to permit persons to whom the Software is12// furnished to do so, subject to the following conditions:13//14// The above copyright notice and this permission notice shall be included in all15// copies or substantial portions of the Software.16//17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE23// SOFTWARE.24//25import QuartzCore26// MARK: - TimingMode27public enum TimingMode {28 29 30 // MARK: Public31 32 case linear33 case easeIn, easeOut, easeInOut34 case spring(damping: CGFloat)35 case discrete36 37 // http://easings.net/38 case easeInSine, easeOutSine, easeInOutSine39 case easeInQuad, easeOutQuad, easeInOutQuad40 case easeInCubic, easeOutCubic, easeInOutCubic41 case easeInQuart, easeOutQuart, easeInOutQuart42 case easeInQuint, easeOutQuint, easeInOutQuint43 case easeInExpo, easeOutExpo, easeInOutExpo44 case easeInCirc, easeOutCirc, easeInOutCirc45 case easeInBack, easeOutBack, easeInOutBack46 47 case custom(c1x: Float, c1y: Float, c2x: Float, c2y: Float)48 49 50 // MARK: Internal51 52 internal var timingFunction: CAMediaTimingFunction {53 54 switch self {55 56 case .linear: return CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)57 case .easeIn: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)58 case .easeOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)59 case .easeInOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)60 case .spring(let damping): return CAMediaTimingFunction(controlPoints: 0.5, 1.1 + (Float(damping) / 3.0), 1, 1)61 case .discrete: return CAMediaTimingFunction(controlPoints: 1, 0, 1, 1)62 63 // http://easings.net/64 case .easeInSine: return CAMediaTimingFunction(controlPoints: 0.47, 0, 0.745, 0.715)65 case .easeOutSine: return CAMediaTimingFunction(controlPoints: 0.39, 0.575, 0.565, 1)66 case .easeInOutSine: return CAMediaTimingFunction(controlPoints: 0.445, 0.05, 0.55, 0.95)67 case .easeInQuad: return CAMediaTimingFunction(controlPoints: 0.55, 0.085, 0.68, 0.53)68 case .easeOutQuad: return CAMediaTimingFunction(controlPoints: 0.25, 0.46, 0.45, 0.94)69 case .easeInOutQuad: return CAMediaTimingFunction(controlPoints: 0.455, 0.03, 0.515, 0.955)70 case .easeInCubic: return CAMediaTimingFunction(controlPoints: 0.55, 0.055, 0.675, 0.19)71 case .easeOutCubic: return CAMediaTimingFunction(controlPoints: 0.215, 0.61, 0.355, 1)72 case .easeInOutCubic: return CAMediaTimingFunction(controlPoints: 0.645, 0.045, 0.355, 1)73 case .easeInQuart: return CAMediaTimingFunction(controlPoints: 0.895, 0.03, 0.685, 0.22)74 case .easeOutQuart: return CAMediaTimingFunction(controlPoints: 0.165, 0.84, 0.44, 1)75 case .easeInOutQuart: return CAMediaTimingFunction(controlPoints: 0.77, 0, 0.175, 1)76 case .easeInQuint: return CAMediaTimingFunction(controlPoints: 0.755, 0.05, 0.855, 0.06)77 case .easeOutQuint: return CAMediaTimingFunction(controlPoints: 0.23, 1, 0.32, 1)78 case .easeInOutQuint: return CAMediaTimingFunction(controlPoints: 0.86, 0, 0.07, 1)79 case .easeInExpo: return CAMediaTimingFunction(controlPoints: 0.95, 0.05, 0.795, 0.035)80 case .easeOutExpo: return CAMediaTimingFunction(controlPoints: 0.19, 1, 0.22, 1)81 case .easeInOutExpo: return CAMediaTimingFunction(controlPoints: 1, 0, 0, 1)82 case .easeInCirc: return CAMediaTimingFunction(controlPoints: 0.6, 0.04, 0.98, 0.335)83 case .easeOutCirc: return CAMediaTimingFunction(controlPoints: 0.075, 0.82, 0.165, 1)84 case .easeInOutCirc: return CAMediaTimingFunction(controlPoints: 0.785, 0.135, 0.15, 0.86)85 case .easeInBack: return CAMediaTimingFunction(controlPoints: 0.6, -0.28, 0.735, 0.045)86 case .easeOutBack: return CAMediaTimingFunction(controlPoints: 0.175, 0.885, 0.32, 1.275)87 case .easeInOutBack: return CAMediaTimingFunction(controlPoints: 0.68, -0.55, 0.265, 1.55)88 89 case .custom(let c1x, let c1y, let c2x, let c2y):90 return CAMediaTimingFunction(controlPoints: c1x, c1y, c2x, c2y)91 }92 }93}...

Full Screen

Full Screen

ReflectionClass_getDefaultProperties_001.phpt

Source:ReflectionClass_getDefaultProperties_001.phpt Github

copy

Full Screen

1--TEST--2ReflectionClass::getDefaultProperties(), ReflectionClass::getStaticProperties()3--CREDITS--4Robin Fernandes <robinf@php.net>5Steve Seear <stevseea@php.net>6--FILE--7<?php8class A {9 static public $statPubC = "stat pubC in A";10 static protected $statProtC = "stat protC in A";11 static private $statPrivC = "stat privC in A";12 static public $statPubA = "stat pubA in A";13 static protected $statProtA = "stat protA in A";14 static private $statPrivA = "stat privA in A";15 public $pubC = "pubC in A";16 protected $protC = "protC in A";17 private $privC = "privC in A";18 public $pubA = "pubA in A";19 protected $protA = "protA in A";20 private $privA = "privA in A";21}22class B extends A {23 static public $statPubC = "stat pubC in B";24 static protected $statProtC = "stat protC in B";25 static private $statPrivC = "stat privC in B";26 static public $statPubB = "stat pubB in B";27 static protected $statProtB = "stat protB in B";28 static private $statPrivB = "stat privB in B";29 public $pubC = "pubC in B";30 protected $protC = "protC in B";31 private $privC = "privC in B";32 public $pubB = "pubB in B";33 protected $protB = "protB in B";34 private $privB = "privB in B";35}36class C extends B {37 static public $statPubC = "stat pubC in C";38 static protected $statProtC = "stat protC in C";39 static private $statPrivC = "stat privC in C";40 public $pubC = "pubC in C";41 protected $protC = "protC in C";42 private $privC = "privC in C";43}44class X {45 static public $statPubC = "stat pubC in X";46 static protected $statProtC = "stat protC in X";47 static private $statPrivC = "stat privC in X";48 public $pubC = "pubC in X";49 protected $protC = "protC in X";50 private $privC = "privC in X";51}52$classes = array('A', 'B', 'C', 'X');53foreach ($classes as $class) {54 $rc = new ReflectionClass($class);55 echo "\n\n---- Static properties in $class ----\n";56 print_r($rc->getStaticProperties());57 echo "\n\n---- Default properties in $class ----\n";58 print_r($rc->getDefaultProperties());59}60?>61--EXPECT--62---- Static properties in A ----63Array64(65 [statPubC] => stat pubC in A66 [statProtC] => stat protC in A67 [statPrivC] => stat privC in A68 [statPubA] => stat pubA in A69 [statProtA] => stat protA in A70 [statPrivA] => stat privA in A71)72---- Default properties in A ----73Array74(75 [statPubC] => stat pubC in A76 [statProtC] => stat protC in A77 [statPrivC] => stat privC in A78 [statPubA] => stat pubA in A79 [statProtA] => stat protA in A80 [statPrivA] => stat privA in A81 [pubC] => pubC in A82 [protC] => protC in A83 [privC] => privC in A84 [pubA] => pubA in A85 [protA] => protA in A86 [privA] => privA in A87)88---- Static properties in B ----89Array90(91 [statPubC] => stat pubC in B92 [statProtC] => stat protC in B93 [statPrivC] => stat privC in B94 [statPubB] => stat pubB in B95 [statProtB] => stat protB in B96 [statPrivB] => stat privB in B97 [statPubA] => stat pubA in A98 [statProtA] => stat protA in A99)100---- Default properties in B ----101Array102(103 [statPubC] => stat pubC in B104 [statProtC] => stat protC in B105 [statPrivC] => stat privC in B106 [statPubB] => stat pubB in B107 [statProtB] => stat protB in B108 [statPrivB] => stat privB in B109 [statPubA] => stat pubA in A110 [statProtA] => stat protA in A111 [pubC] => pubC in B112 [protC] => protC in B113 [privC] => privC in B114 [pubB] => pubB in B115 [protB] => protB in B116 [privB] => privB in B117 [pubA] => pubA in A118 [protA] => protA in A119)120---- Static properties in C ----121Array122(123 [statPubC] => stat pubC in C124 [statProtC] => stat protC in C125 [statPrivC] => stat privC in C126 [statPubB] => stat pubB in B127 [statProtB] => stat protB in B128 [statPubA] => stat pubA in A129 [statProtA] => stat protA in A130)131---- Default properties in C ----132Array133(134 [statPubC] => stat pubC in C135 [statProtC] => stat protC in C136 [statPrivC] => stat privC in C137 [statPubB] => stat pubB in B138 [statProtB] => stat protB in B139 [statPubA] => stat pubA in A140 [statProtA] => stat protA in A141 [pubC] => pubC in C142 [protC] => protC in C143 [privC] => privC in C144 [pubB] => pubB in B145 [protB] => protB in B146 [pubA] => pubA in A147 [protA] => protA in A148)149---- Static properties in X ----150Array151(152 [statPubC] => stat pubC in X153 [statProtC] => stat protC in X154 [statPrivC] => stat privC in X155)156---- Default properties in X ----157Array158(159 [statPubC] => stat pubC in X160 [statProtC] => stat protC in X161 [statPrivC] => stat privC in X162 [pubC] => pubC in X163 [protC] => protC in X164 [privC] => privC in X165)...

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1namespace Atoum\tests\units;2use \mageekguy\atoum;3{4 public function testMyFunction()5 {6 ->if($myClass = new \MyClass())7 ->object($myClass->myFunction())8 ->isInstanceOf('MyClass')9 ;10 }11}12namespace PHPUnit\tests\units;13use \PHPUnit_Framework_TestCase;14{15 public function testMyFunction()16 {17 $myClass = new \MyClass();18 $this->assertInstanceOf('MyClass', $myClass->myFunction());19 }20}21namespace MyClass;22{23 public function myFunction()24 {25 return new MyClass();26 }27}28require_once __DIR__ . '/vendor/autoload.php';29use mageekguy\atoum;30use PHPUnit\tests\units;31$runner = new atoum\scripts\runner();32$runner->addTestsFromDirectory(__DIR__ . '/tests/units');33$runner->run();34{35 "require-dev": {36 }37}

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1namespace Atoum\tests\units;2use \mageekguy\atoum;3{4 public function test()5 {6 ->if($this->newTestedInstance())7 ->object($this->testedInstance->test())->isInstanceOf('Atoum\tests\units\test')8 ;9 }10}11namespace PHPUnit\tests\units;12use \mageekguy\atoum;13{14 public function test()15 {16 ->if($this->newTestedInstance())17 ->object($this->testedInstance->test())->isInstanceOf('PHPUnit\tests\units\test')18 ;19 }20}21namespace PHPSpec\tests\units;22use \mageekguy\atoum;23{24 public function test()25 {26 ->if($this->newTestedInstance())27 ->object($this->testedInstance->test())->isInstanceOf('PHPSpec\tests\units\test')28 ;29 }30}31namespace PHPSpec\tests\units;32use \mageekguy\atoum;33{34 public function test()35 {36 ->if($this->newTestedInstance())37 ->object($this->testedInstance->test())->isInstanceOf('PHPSpec\tests\units\test')38 ;39 }40}41namespace PHPSpec\tests\units;42use \mageekguy\atoum;43{44 public function test()45 {46 ->if($this->newTestedInstance())47 ->object($this->testedInstance->test())->isInstanceOf('PHPSpec\tests\units

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1namespace Atoum\tests\units;2use \mageekguy\atoum;3{4 public function testAdd()5 {6 ->if($this->newTestedInstance)7 ->object($this->testedInstance->add(1, 2))->isIdenticalTo(3)8 ;9 }10}11namespace PhpUnit\tests;12use \PHPUnit_Framework_TestCase;13{14 public function testAdd()15 {16 $this->assertEquals(1 + 2, 3);17 }18}19namespace PhpSpec\spec;20use PhpSpec\ObjectBehavior;21use Prophecy\Argument;22{23 public function it_is_initializable()24 {25 $this->shouldHaveType('PhpSpec\spec\Test');26 }27 public function it_should_return_3_when_add_1_and_2()28 {29 $this->add(1, 2)->shouldReturn(3);30 }31}32namespace Codeception\tests\unit;33{34 public function testAdd()35 {36 $this->assertEquals(1 + 2, 3);37 }38}39namespace PHPUnit\tests;40use PHPUnit\Framework\TestCase;41{42 public function testAdd()43 {44 $this->assertEquals(1 + 2, 3);45 }46}47namespace PhpUnit\tests;48use PHPUnit\Framework\TestCase;49{50 public function testAdd()51 {52 $this->assertEquals(1 + 2, 3);53 }54}55namespace Behat\tests\features\bootstrap;56use Behat\Behat\Context\Context;57{58 * @Given /^I have entered (\d+) into the calculator$/59 public function iHaveEnteredIntoTheCalculator($arg1

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1{2 public function testGet()3 {4 ->given(5 ->when(6 $this->testedInstance->get()7 ->string($this->testedInstance->getResponseBody())8 ->contains('Google')9 ;10 }11}12{13 public function testGet()14 {15 ->given(16 ->when(17 $this->testedInstance->get()18 ->string($this->testedInstance->getResponseBody())19 ->contains('Google')20 ;21 }22}23{24 public function testGet()25 {26 ->given(27 ->when(28 $this->testedInstance->get()29 ->string($this->testedInstance->getResponseBody())30 ->contains('Google')31 ;32 }33}34{35 public function testGet()36 {37 ->given(38 ->when(39 $this->testedInstance->get()40 ->string($this->testedInstance->getResponseBody())41 ->contains('Google')42 ;43 }44}45{46 public function testGet()47 {48 ->given(49 ->when(50 $this->testedInstance->get()

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1class myClass {2 public function myMethod($param1, $param2) {3 return $param1 + $param2;4 }5}6namespace {7 class myClass extends atoum\test {8 public function testMyMethod() {9 ->given($myClass = new \myClass())10 ->if($result = $myClass->myMethod(1, 2))11 ->integer($result)->isEqualTo(3)12 ;13 }14 }15}16class myClass {17 public function myMethod($param1, $param2) {18 return $param1 + $param2;19 }20}21namespace {22 class myClass extends atoum\test {23 public function testMyMethod() {24 ->given($myClass = new \myClass())25 ->if($result = $myClass->myMethod(1, 2))26 ->integer($result)->isEqualTo(3)27 ;28 }29 }30}31class myClass {32 public function myMethod($param1, $param2) {33 return $param1 + $param2;34 }35}36namespace {37 class myClass extends atoum\test {38 public function testMyMethod() {39 ->given($myClass = new \myClass())40 ->if($result = $myClass->myMethod(1, 2))41 ->integer($result)->isEqualTo(3)42 ;43 }44 }45}46class myClass {47 public function myMethod($param1, $param2) {48 return $param1 + $param2;49 }50}51namespace {52 class myClass extends atoum\test {53 public function testMyMethod()

Full Screen

Full Screen

in

Using AI Code Generation

copy

Full Screen

1{2 public function test()3 {4 $this->assert->boolean(true)->isTrue();5 }6}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful