#ifdef STAN_OPENCL

#include <stan/math/opencl/opencl.hpp>
#include <stan/math/opencl/kernel_cl.hpp>
#include <gtest/gtest.h>

using stan::math::matrix_cl;
using stan::math::opencl_kernels::in_buffer;
using stan::math::opencl_kernels::in_out_buffer;
using stan::math::opencl_kernels::internal::assign_events;
using stan::math::opencl_kernels::out_buffer;

TEST(assign_event, correct_vectors) {
  matrix_cl m;
  // pointers not set up to work yet; TBD if needed
  // matrix_cl *mp = &m;
  cl::Event e;
  assign_events<in_buffer>(e, m);
  EXPECT_EQ(m.read_events().size(), 1);
  EXPECT_EQ(m.write_events().size(), 0);

  assign_events<out_buffer>(e, m);
  EXPECT_EQ(m.read_events().size(), 1);
  EXPECT_EQ(m.write_events().size(), 1);

  assign_events<in_out_buffer>(e, m);
  EXPECT_EQ(m.read_events().size(), 2);
  EXPECT_EQ(m.write_events().size(), 2);
}
#endif

#ifdef STAN_OPENCL

#include <stan/math/opencl/opencl.hpp>
#include <stan/math/opencl/kernel_cl.hpp>
#include <gtest/gtest.h>

using stan::math::matrix_cl;
using stan::math::opencl_kernels::in_buffer;
using stan::math::opencl_kernels::in_out_buffer;
using stan::math::opencl_kernels::internal::assign_events;
using stan::math::opencl_kernels::out_buffer;

TEST(assign_event, correct_vectors) {
  matrix_cl m;
  // pointers not set up to work yet; TBD if needed
  // matrix_cl *mp = &m;
  cl::Event e;
  assign_events<in_buffer>(e, m);
  EXPECT_EQ(m.in_events().size(), 1);
  EXPECT_EQ(m.out_events().size(), 0);

  assign_events<out_buffer>(e, m);
  EXPECT_EQ(m.in_events().size(), 1);
  EXPECT_EQ(m.out_events().size(), 1);

  assign_events<in_out_buffer>(e, m);
  EXPECT_EQ(m.in_events().size(), 2);
  EXPECT_EQ(m.out_events().size(), 2);
}
#endif

--- 
+++ 
@@ -16,15 +16,15 @@
   // matrix_cl *mp = &m;
   cl::Event e;
   assign_events<in_buffer>(e, m);
-  EXPECT_EQ(m.in_events().size(), 1);
-  EXPECT_EQ(m.out_events().size(), 0);
+  EXPECT_EQ(m.read_events().size(), 1);
+  EXPECT_EQ(m.write_events().size(), 0);
 
   assign_events<out_buffer>(e, m);
-  EXPECT_EQ(m.in_events().size(), 1);
-  EXPECT_EQ(m.out_events().size(), 1);
+  EXPECT_EQ(m.read_events().size(), 1);
+  EXPECT_EQ(m.write_events().size(), 1);
 
   assign_events<in_out_buffer>(e, m);
-  EXPECT_EQ(m.in_events().size(), 2);
-  EXPECT_EQ(m.out_events().size(), 2);
+  EXPECT_EQ(m.read_events().size(), 2);
+  EXPECT_EQ(m.write_events().size(), 2);
 }
 #endif
Revert "Forgot to update test for assign_event"

This reverts commit 7256c1fbc6e3dfde24d49a73a93fb4011dd16934.
