Files
sdk/runtime/vm/base64_test.cc
T
Alexander Aprelev a5e41681e5 Add support for expression compilation via service.
If there is registered expression compiler, VM debugger uses it to compile expressions. Otherwise, it will fallback to use kernel service compiler.
This is needed to support Flutter use case where compiler is running on developer's host machine, not on the device where VM is running.

Bug: dartbug.com/31981
Change-Id: I8bdfc8ab45a57c306169abe189f1e24e1b0bcf40
Reviewed-on: https://dart-review.googlesource.com/57520
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-06-05 04:16:39 +00:00

33 lines
979 B
C++

// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/base64.h"
#include "platform/assert.h"
#include "vm/unit_test.h"
namespace dart {
TEST_CASE(Base64Decode) {
intptr_t decoded_len;
uint8_t* decoded_bytes =
DecodeBase64(thread->zone(), "SGVsbG8sIHdvcmxkIQo=", &decoded_len);
const char expected_bytes[] = "Hello, world!\n";
intptr_t expected_len = strlen(expected_bytes);
EXPECT(!memcmp(expected_bytes, decoded_bytes, expected_len));
EXPECT_EQ(expected_len, decoded_len);
}
TEST_CASE(Base64DecodeMalformed) {
intptr_t decoded_len;
EXPECT(DecodeBase64(thread->zone(), "SomethingMalformed", &decoded_len) ==
nullptr);
}
TEST_CASE(Base64DecodeEmpty) {
intptr_t decoded_len;
EXPECT(DecodeBase64(thread->zone(), "", &decoded_len) == nullptr);
}
} // namespace dart