OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/circular_buffer.h" | 12 #include "platforms/stm/disco_dartino/src/circular_buffer.h" |
13 | 13 |
14 void compare_buffers(uint8_t* buffer1, uint8_t* buffer2, int size) { | 14 void compare_buffers(uint8_t* buffer1, uint8_t* buffer2, int size) { |
15 for (int i = 0; i < size; i++) { | 15 for (int i = 0; i < size; i++) { |
16 EXPECT_EQ(buffer1[i], buffer2[i]); | 16 EXPECT_EQ(buffer1[i], buffer2[i]); |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 // This test will alternate between write and read, and always try to write | 20 // This test will alternate between write and read, and always try to write |
21 // 'to_write' bytes and read 'to_read' bytes. This will continue until 1000 | 21 // 'to_write' bytes and read 'to_read' bytes. This will continue until 1000 |
22 // bytes have been both written and read. | 22 // bytes have been both written and read. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 int main(int argc, char** argv) { | 101 int main(int argc, char** argv) { |
102 write_test(); | 102 write_test(); |
103 | 103 |
104 for (int i = 1; i < 10; i++) { | 104 for (int i = 1; i < 10; i++) { |
105 for (int j = 1; j < 10; j++) { | 105 for (int j = 1; j < 10; j++) { |
106 write_read_test(i, j); | 106 write_read_test(i, j); |
107 } | 107 } |
108 } | 108 } |
109 } | 109 } |
OLD | NEW |