FTestHelpers.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2017 Google
  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. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <XCTest/XCTest.h>
  18. #import "FirebaseDatabase/Sources/Api/Private/FIRDatabaseReference_Private.h"
  19. #import "FirebaseDatabase/Sources/Core/FRepoManager.h"
  20. #import "FirebaseDatabase/Sources/Snapshot/FSnapshotUtilities.h"
  21. #import "FirebaseDatabase/Sources/Utilities/Tuples/FTupleFirebase.h"
  22. #import "FirebaseDatabase/Tests/Helpers/FTestContants.h"
  23. #define WAIT_FOR(x) \
  24. [self waitUntil:^{ \
  25. return (BOOL)(x); \
  26. }];
  27. #define NODE(__node) [FSnapshotUtilities nodeFrom:(__node)]
  28. #define PATH(__path) [FPath pathWithString:(__path)]
  29. @interface FTestHelpers : XCTestCase
  30. + (NSString *)databaseURL;
  31. + (FIRDatabaseConfig *)defaultConfig;
  32. + (FIRDatabaseConfig *)configForName:(NSString *)name;
  33. + (FIRDatabase *)defaultDatabase;
  34. + (FIRDatabase *)databaseForConfig:(FIRDatabaseConfig *)config;
  35. + (FIRDatabaseReference *)getRandomNode;
  36. + (FIRDatabaseReference *)getRandomNodeWithoutPersistence;
  37. + (FTupleFirebase *)getRandomNodePair;
  38. + (FTupleFirebase *)getRandomNodePairWithoutPersistence;
  39. + (FTupleFirebase *)getRandomNodeTriple;
  40. + (id<FNode>)leafNodeOfSize:(NSUInteger)size;
  41. @end