hw8: autoformat

This commit is contained in:
2020-11-04 16:50:11 +03:00
parent a0d68131c9
commit b439368580
3 changed files with 10 additions and 14 deletions

View File

@@ -1,9 +1,7 @@
#include "buf.h"
void *
buf_grow1(void *v, size_t esize, ptrdiff_t n)
{
struct buf *p;
void* buf_grow1(void* v, size_t esize, ptrdiff_t n) {
struct buf* p;
size_t max = (size_t)-1 - sizeof(struct buf);
if (v) {
p = buf_ptr(v);

View File

@@ -2,8 +2,8 @@
#include "buf.h"
int main () {
float *values = 0;
int main() {
float* values = 0;
for (size_t i = 0; i < 25; i++)
buf_push(values, rand() / (float)RAND_MAX);
for (size_t i = 0; i < buf_size(values); i++)

View File

@@ -1,14 +1,13 @@
#include <stdio.h>
#include <stdint.h>
#include <setjmp.h>
#include <stdint.h>
#include <stdio.h>
#include "minctest.h"
#include "buf.h"
void test_buf_squares_operator() {
long *ai = 0;
long* ai = 0;
for (int i = 0; i < 10000; i++)
buf_push(ai, i);
lequal((int)buf_size(ai), 10000);
@@ -20,7 +19,7 @@ void test_buf_squares_operator() {
}
void test_buf_grow_trunc() {
long *ai = 0;
long* ai = 0;
buf_grow(ai, 1000);
lequal((int)buf_capacity(ai), 1000);
lequal((int)buf_size(ai), 0);
@@ -30,7 +29,7 @@ void test_buf_grow_trunc() {
}
void test_buf_base() {
float *a = 0;
float* a = 0;
lok(buf_capacity(a) == 0);
lok(buf_size(a) == 0);
buf_push(a, 1.3f);
@@ -61,8 +60,7 @@ void test_buf_base() {
buf_free(a);
}
int main(int argc, char *argv[])
{
int main(int argc, char* argv[]) {
lrun("buf_push(), []", test_buf_squares_operator);
lrun("buf_grow(), buf_trunc", test_buf_grow_trunc);
lrun("buf_base_test", test_buf_base);