[nullability] Break out test cases for overloaded operators into separate tests.

More fine-grained tests make it easier to see what exactly is failing when a
test fails. I'm breaking these out now because I'm about to add a test for a
free overloaded operator.

PiperOrigin-RevId: 526847959
diff --git a/nullability_verification/test/function_calls.cc b/nullability_verification/test/function_calls.cc
index 1162af6..26b295c 100644
--- a/nullability_verification/test/function_calls.cc
+++ b/nullability_verification/test/function_calls.cc
@@ -39,29 +39,6 @@
     }
   )cc"));
 
-  // overloaded operator call
-  EXPECT_TRUE(checkDiagnostics(R"cc(
-    struct MakeNonnull {
-      int *_Nonnull operator()();
-    };
-    struct MakeNullable {
-      int *_Nullable operator()();
-    };
-    struct MakeUnannotated {
-      int *operator()();
-    };
-    void target() {
-      MakeNonnull makeNonnull;
-      *makeNonnull();
-
-      MakeNullable makeNullable;
-      *makeNullable();  // [[unsafe]]
-
-      MakeUnannotated makeUnannotated;
-      *makeUnannotated();
-    }
-  )cc"));
-
   // function pointer
   EXPECT_TRUE(checkDiagnostics(R"cc(
     void target(int* _Nonnull (*makeNonnull)(),
@@ -148,42 +125,6 @@
     }
   )cc"));
 
-  // overloaded operator with single param
-  EXPECT_TRUE(checkDiagnostics(R"cc(
-    // map<int * _Nonnull, int>
-    struct MapWithNonnullKeys {
-      int &operator[](int *_Nonnull key);
-    };
-    // map<int * _Nullable, int>
-    struct MapWithNullableKeys {
-      int &operator[](int *_Nullable key);
-    };
-    // map<int *, int>
-    struct MapWithUnannotatedKeys {
-      int &operator[](int *key);
-    };
-    void target(int *_Nonnull ptr_nonnull, int *_Nullable ptr_nullable,
-                int *ptr_unannotated) {
-      MapWithNonnullKeys nonnull_keys;
-      nonnull_keys[nullptr] = 42;  // [[unsafe]]
-      nonnull_keys[ptr_nonnull] = 42;
-      nonnull_keys[ptr_nullable] = 42;  // [[unsafe]]
-      nonnull_keys[ptr_unannotated] = 42;
-
-      MapWithNullableKeys nullable_keys;
-      nullable_keys[nullptr] = 42;
-      nullable_keys[ptr_nonnull] = 42;
-      nullable_keys[ptr_nullable] = 42;
-      nullable_keys[ptr_unannotated] = 42;
-
-      MapWithUnannotatedKeys unannotated_keys;
-      unannotated_keys[nullptr] = 42;
-      unannotated_keys[ptr_nonnull] = 42;
-      unannotated_keys[ptr_nullable] = 42;
-      unannotated_keys[ptr_unannotated] = 42;
-    }
-  )cc"));
-
   // free function with multiple params of mixed nullability
   EXPECT_TRUE(checkDiagnostics(R"cc(
     void takeMixed(int *, int *_Nullable, int *_Nonnull);
@@ -192,17 +133,6 @@
     }
   )cc"));
 
-  // overloaded operator with multiple params of mixed nullability
-  EXPECT_TRUE(checkDiagnostics(R"cc(
-    struct TakeMixed {
-      void operator()(int *, int *_Nullable, int *_Nonnull);
-    };
-    void target() {
-      TakeMixed takeMixed;
-      takeMixed(nullptr, nullptr, nullptr);  // [[unsafe]]
-    }
-  )cc"));
-
   // member function
   EXPECT_TRUE(checkDiagnostics(R"cc(
     struct Foo {
@@ -361,6 +291,80 @@
   )cc"));
 }
 
+TEST(PointerNullabilityTest, CallMemberOperatorNoParams) {
+  EXPECT_TRUE(checkDiagnostics(R"cc(
+    struct MakeNonnull {
+      int *_Nonnull operator()();
+    };
+    struct MakeNullable {
+      int *_Nullable operator()();
+    };
+    struct MakeUnannotated {
+      int *operator()();
+    };
+    void target() {
+      MakeNonnull makeNonnull;
+      *makeNonnull();
+
+      MakeNullable makeNullable;
+      *makeNullable();  // [[unsafe]]
+
+      MakeUnannotated makeUnannotated;
+      *makeUnannotated();
+    }
+  )cc"));
+}
+
+TEST(PointerNullabilityTest, CallMemberOperatorOneParam) {
+  // overloaded operator with single param
+  EXPECT_TRUE(checkDiagnostics(R"cc(
+    // map<int * _Nonnull, int>
+    struct MapWithNonnullKeys {
+      int &operator[](int *_Nonnull key);
+    };
+    // map<int * _Nullable, int>
+    struct MapWithNullableKeys {
+      int &operator[](int *_Nullable key);
+    };
+    // map<int *, int>
+    struct MapWithUnannotatedKeys {
+      int &operator[](int *key);
+    };
+    void target(int *_Nonnull ptr_nonnull, int *_Nullable ptr_nullable,
+                int *ptr_unannotated) {
+      MapWithNonnullKeys nonnull_keys;
+      nonnull_keys[nullptr] = 42;  // [[unsafe]]
+      nonnull_keys[ptr_nonnull] = 42;
+      nonnull_keys[ptr_nullable] = 42;  // [[unsafe]]
+      nonnull_keys[ptr_unannotated] = 42;
+
+      MapWithNullableKeys nullable_keys;
+      nullable_keys[nullptr] = 42;
+      nullable_keys[ptr_nonnull] = 42;
+      nullable_keys[ptr_nullable] = 42;
+      nullable_keys[ptr_unannotated] = 42;
+
+      MapWithUnannotatedKeys unannotated_keys;
+      unannotated_keys[nullptr] = 42;
+      unannotated_keys[ptr_nonnull] = 42;
+      unannotated_keys[ptr_nullable] = 42;
+      unannotated_keys[ptr_unannotated] = 42;
+    }
+  )cc"));
+}
+
+TEST(PointerNullabilityTest, CallMemberOperatorMultipleParams) {
+  EXPECT_TRUE(checkDiagnostics(R"cc(
+    struct TakeMixed {
+      void operator()(int *, int *_Nullable, int *_Nonnull);
+    };
+    void target() {
+      TakeMixed takeMixed;
+      takeMixed(nullptr, nullptr, nullptr);  // [[unsafe]]
+    }
+  )cc"));
+}
+
 }  // namespace
 }  // namespace nullability
 }  // namespace tidy