/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #undef NDEBUG #include #include #include #include #include using namespace android; void log(const char* prefix, int *b, size_t num); void test0(SharedBufferServer& s, SharedBufferClient& c, size_t num, int* list); // ---------------------------------------------------------------------------- int main(int argc, char** argv) { SharedClient client; SharedBufferServer s(&client, 0, 4, 0); SharedBufferClient c(&client, 0, 4, 0); printf("basic test 0\n"); int list0[4] = {0, 1, 2, 3}; test0(s, c, 4, list0); printf("basic test 1\n"); int list1[4] = {2, 1, 0, 3}; test0(s, c, 4, list1); printf("resize test\n"); s.resize(5); c.setBufferCount(5); int list2[5] = {0, 1, 2, 4, 3}; test0(s, c, 5, list2); return 0; } void log(const char* prefix, int *b, size_t num) { printf("%s: ", prefix); for (size_t i=0 ; i