test/src/runtime/wasm_memory_test.cpp
TEST_F(MemoryHeapTest, AllocatedTooBigMemoryFailed) {
  // fully allocate memory
  auto ptr1 = memory_.allocate(memory_size_);
  // check that ptr1 is not -1, thus memory was allocated
  ASSERT_NE(ptr1, -1);

  // The memory size that can be allocated is within interval (0, kMaxMemorySize
  // - memory_size_]. Trying to allocate more
  auto big_memory_size = WasmMemoryImpl::kMaxMemorySize - memory_size_ + 1;
  ASSERT_EQ(memory_.allocate(big_memory_size), 0);
}
/**
 * @given memory of size memory_size_ that is fully allocated
 * @when trying to allocate memory of size bigger than
 * (kMaxMemorySize-memory_size_)
 * @then -1 is not returned by allocate method indicating that memory was not
 * allocated
 */
@given memory of size memory_size_ that is fully allocated
@when trying to allocate memory of size bigger than
(kMaxMemorySize-memory_size_)
@then -1 is not returned by allocate method indicating that memory was not
allocated
@given memory of size memory_size_ that is fully allocated @when trying to allocate memory of size bigger than ( kMaxMemorySize - memory_size_ ) @then - 1 is not returned by allocate method indicating that memory was not allocated
TEST_F(MemoryHeapTest, AllocatedTooBigMemoryFailed) {
  auto ptr1 = memory_.allocate(memory_size_);
  ASSERT_NE(ptr1, -1);
  auto big_memory_size = WasmMemoryImpl::kMaxMemorySize - memory_size_ + 1;
  ASSERT_EQ(memory_.allocate(big_memory_size), 0);
}
TEST_F ( MemoryHeapTest , AllocatedTooBigMemoryFailed ) { auto ptr1 = memory_ . allocate ( memory_size_ ) ; ASSERT_NE ( ptr1 , -1 ) ; auto big_memory_size = WasmMemoryImpl :: kMaxMemorySize - memory_size_ + 1 ; ASSERT_EQ ( memory_ . allocate ( big_memory_size ) , 0 ) ; }
@given memory of size memory_size_ that is fully allocated
 @when trying to allocate memory of size bigger than
 (kMaxMemorySize-memory_size_)
 @then -1 is not returned by allocate method indicating that memory was not
 allocated
@given memory of size memory_size_ that is fully allocated @when trying to allocate memory of size bigger than ( kMaxMemorySize - memory_size_ ) @then - 1 is not returned by allocate method indicating that memory was not allocated
// fully allocate memory // check that ptr1 is not -1, thus memory was allocated // The memory size that can be allocated is within interval (0, kMaxMemorySize // - memory_size_]. Trying to allocate more