| OLD | NEW |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <cinttypes> | 6 #include <cinttypes> |
| 7 | 7 |
| 8 #define TESTING | 8 #define TESTING |
| 9 #include "src/shared/assert.h" | 9 #include "src/shared/assert.h" |
| 10 #include "src/shared/atomic.h" | 10 #include "src/shared/atomic.h" |
| 11 | 11 |
| 12 #include "platforms/stm/disco_fletch/src/page_allocator.h" | 12 #include "platforms/stm/disco_dartino/src/page_allocator.h" |
| 13 | 13 |
| 14 void Test() { | 14 void Test() { |
| 15 PageAllocator *allocator = new PageAllocator(); | 15 PageAllocator *allocator = new PageAllocator(); |
| 16 void* arena1; | 16 void* arena1; |
| 17 int rc = posix_memalign(&arena1, PAGE_SIZE, 10); | 17 int rc = posix_memalign(&arena1, PAGE_SIZE, 10); |
| 18 EXPECT_EQ(0, rc); | 18 EXPECT_EQ(0, rc); |
| 19 uintptr_t start = reinterpret_cast<uintptr_t>(arena1); | 19 uintptr_t start = reinterpret_cast<uintptr_t>(arena1); |
| 20 int arena1_bit = allocator->AddArena("test", start, PAGE_SIZE * 10); | 20 int arena1_bit = allocator->AddArena("test", start, PAGE_SIZE * 10); |
| 21 EXPECT_EQ(1, arena1_bit); | 21 EXPECT_EQ(1, arena1_bit); |
| 22 | 22 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 EXPECT_EQ(0xaa, map[i]); | 97 EXPECT_EQ(0xaa, map[i]); |
| 98 } | 98 } |
| 99 | 99 |
| 100 free(arena); | 100 free(arena); |
| 101 } | 101 } |
| 102 | 102 |
| 103 int main(int argc, char** argv) { | 103 int main(int argc, char** argv) { |
| 104 Test(); | 104 Test(); |
| 105 TestExternalMap(); | 105 TestExternalMap(); |
| 106 } | 106 } |
| OLD | NEW |